Method and device for processing video signal

ABSTRACT

Embodiments of the present invention provide a method and device for processing a video signal. A method for processing a video signal according to an embodiment of the present specification comprises the steps of: acquiring position information of a last significant coefficient according to scanning order in a transform block; and performing residual coding on the basis of the position information of the last significant coefficient. The position information of the last significant coefficient includes a first prefix for a column position of the last significant coefficient and a second prefix for a row position of the last significant coefficient; a range of the first prefix is determined on the basis of an effective width of the transform block; a range of the second prefix is determined on the basis of an effective height of the transform block; if a width of the transform block corresponds to a first size, the effective width of the transform block is determined to be a second size; if a height of the transform block corresponds to the first size, the effective height of the transform block is determined to be the second size; and the second size is configured to be smaller than the first size.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is the National Stage filing under 35 U.S.C. 371 ofInternational Application No. PCT/KR2020/000421, filed on Jan. 9, 2020,which claims the benefit of U.S. Provisional Application No. 62/791,863,filed on Jan. 13, 2019, the contents of which are all herebyincorporated by reference herein in their entirety.

TECHNICAL FIELD

Embodiments of the present disclosure relate to a method and apparatusfor processing a video signal, and more particularly, to a method andapparatus for encoding/decoding residual data.

BACKGROUND ART

Compression coding refers to a signal processing technique fortransmitting digitalized information through a communication line orstoring the same in an appropriate form in a storage medium. Media suchas video, images and audio can be objects of compression coding and,particularly, a technique of performing compression coding on images iscalled video image compression.

Next-generation video content will have features of a high spatialresolution, a high frame rate and high dimensionality of scenerepresentation. To process such content, memory storage, a memory accessrate and processing power will significantly increase.

Accordingly, it is necessary to design a coding tool for processingnext-generation image content more efficiently.

DISCLOSURE Technical Problem

Embodiments of the present disclosure propose a method for encoding anddecoding residual information based on a position of the lastsignificant coefficient within a transform block according to scanningorder.

Technical objects to be achieved in embodiments of the presentdisclosure are not limited to the aforementioned technical objects, andother technical objects not described above may be evidently understoodby a person having ordinary knowledge in the art to which the presentdisclosure pertains from the following description.

Technical Solution

A method of processing a video signal according to an embodiment of thepresent disclosure includes obtaining information on a position of thelast significant coefficient according to scanning order within atransform block, determining a transform target area within the currenttransform block based on the position information of the lastsignificant coefficient, and performing an inverse transform on thetransform target area. The position information of the last significantcoefficient includes a first prefix for a column position of the lastsignificant coefficient and a second prefix for a row position of thelast significant coefficient. The range of the first prefix isdetermined based on the valid width of the transform block. The range ofthe second prefix is determined based on a valid height of the transformblock. When the width of the transform block corresponds to a firstsize, a valid width of the transform block is determined as a secondsize. When the height of the transform block corresponds to the firstsize, the valid height of the transform block is determined as thesecond size and the second size is set to be smaller than the firstsize.

A method for encoding a video signal according to another embodiment ofthe present disclosure includes generating a transform block including atransform coefficient by performing a transform on a transform targetarea of a processing target block, wherein the processing target blockincludes a residual signal except a prediction signal in the videosignal and encoding residual coding information related to the residualsignal. The residual coding information includes position information ofa last significant coefficient according to a scanning order within thetransform block. The position information of the last significantcoefficient includes a first prefix for a column position of the lastsignificant coefficient and a second prefix for a row position of thelast significant coefficient. The range of the first prefix isdetermined based on a significant width of the transform block. Therange of the second prefix is determined based on a significant heightof the transform block. When the width of the transform blockcorresponds to a first size, the significant width of the transformblock is determined as a second size. When the height of the transformblock corresponds to the first size, the significant height of thetransform block is determined as the second size. The second size issmaller than the first size.

An apparatus for decoding a video signal according to an embodiment ofthe present disclosure includes a memory storing the video signal and aprocessor connected to the memory and configured to process the videosignal. The processor is configured to obtain information on a positionof the last significant coefficient according to scanning order within atransform block, determine a transform target area within the currenttransform block based on the position information of the lastsignificant coefficient, and perform an inverse transform on thetransform target area. The position information of the last significantcoefficient includes a first prefix for a column position of the lastsignificant coefficient and a second prefix for a row position of thelast significant coefficient. The range of the first prefix isdetermined based on the valid width of the transform block. The range ofthe second prefix is determined based on a valid height of the transformblock. When the width of the transform block corresponds to a firstsize, a valid width of the transform block is determined as a secondsize. When the height of the transform block corresponds to the firstsize, the valid height of the transform block is determined as thesecond size and the second size is set to be smaller than the firstsize.

An apparatus for encoding a video signal according to an embodiment ofthe present disclosure includes a memory storing the video signal and aprocessor connected to the memory and configured to process the videosignal. The processor is configured to generate a transform blockincluding a transform coefficient by performing a transform on atransform target area of a processing target block including a residualsignal except a prediction signal in the video signal and to encoderesidual coding information related to the residual signal. The residualcoding information includes position information of a last significantcoefficient according to a scanning order within the transform block.The position information of the last significant coefficient includes afirst prefix for a column position of the last significant coefficientand a second prefix for a row position of the last significantcoefficient. The range of the first prefix is determined based on asignificant width of the transform block. The range of the second prefixis determined based on a significant height of the transform block. Whenthe width of the transform block corresponds to a first size, thesignificant width of the transform block is determined as a second size.When the height of the transform block corresponds to the first size,the significant height of the transform block is determined as thesecond size. The second size is smaller than the first size.

An embodiment of the present disclosure provides a non-transitorycomputer-readable medium storing one or more instructions. The one ormore instructions executed by one or more processors control a videosignal processing apparatus to obtain information on a position of thelast significant coefficient according to scanning order within atransform block, determine a transform target area within the currenttransform block based on the position information of the lastsignificant coefficient, and perform an inverse transform on thetransform target area. The position information of the last significantcoefficient includes a first prefix for a column position of the lastsignificant coefficient and a second prefix for a row position of thelast significant coefficient. When the width of the transform blockcorresponds to a first size, a valid width of the transform block isdetermined as a second size. When the height of the transform blockcorresponds to the first size, a valid height of the transform block isdetermined as the second size, and the second size is set to be smallerthan the first size.

In an embodiment, the first size may be set to 32, and the second sizemay be set to 16.

In an embodiment, when the width of the transform block is differentfrom the first size, the significant width of the transform block isdetermined as a smaller value among the width of the transform block andthe first size, and when the height of the transform block is differentfrom the first size, the significant height of the transform block isdetermined as a smaller value among the height of the transform blockand the first size.

In an embodiment, an input parameter for a binarization of the firstprefix is determined based on the width of the transform block, and aninput parameter for a binarization of the second prefix is determinedbased on the height of the transform block.

In an embodiment, the column position of the last significantcoefficient is determined based on the first prefix and a first suffix,the row position of the last significant coefficient is determined basedon the second prefix and a second suffix, the first suffix is obtainedwhen the first prefix is greater than a reference value, and the secondsuffix is obtained when the second prefix is greater than the referencevalue.

An embodiment for the decoding of a video signal may further includedetermining a transform target area and performing an inverse transformon the transform target area. Determining the transform target area mayinclude setting the width or height of the transform target area as thesecond size and deriving a portion other than the transform target areawithin the transform block to be 0, when the width or height of thetransform block corresponds to the first size.

In an embodiment for the encoding of the video signal, generating thetransform block may include setting the width or height of the transformtarget area as the second size and deriving a portion other than thetransform target area within the processing target block to be 0, whenwidth or height of the processing target block corresponds to the firstsize.

Advantageous Effects

According to an embodiment of the present disclosure, complexitynecessary for a transform and residual coding can be significantlyreduced by performing a transform through encoding/decoding for aposition of the last significant coefficient within a transform blockbased on a size of the transform block.

Effects which may be obtained by the present disclosure are not limitedto the aforementioned effects, and other technical effects not describedabove may be evidently understood by a person having ordinary skill inthe art to which the present disclosure pertains from the followingdescription.

DESCRIPTION OF DRAWINGS

The accompanying drawings, which are included herein as a part of thedescription for help understanding the present disclosure, provideembodiments of the present disclosure, and describe the technicalfeatures of the present disclosure with the description below.

FIG. 1 shows an example of a video coding system as an embodiment towhich the present disclosure is applied.

FIG. 2 is a schematic block diagram of an encoding apparatus whichencodes video/image signals as an embodiment to which the presentdisclosure is applied.

FIG. 3 is a schematic block diagram of a decoding apparatus whichdecodes image signals as an embodiment to which the present disclosureis applied.

FIG. 4 is a configuration diagram of a content streaming system anembodiment to which the present disclosure is applied.

FIG. 5 shows embodiments to which the present disclosure is applicable,FIG. 5A is a diagram for describing a block segmentation structureaccording to QT (Quad Tree), FIG. 5B is a diagram for describing a blocksegmentation structure according to BT (Binary Tree), FIG. 5C is adiagram for describing a block segmentation structure according to TT(Ternary Tree), and FIG. 5D is a diagram for describing a blocksegmentation structure according to AT (Asymmetric Tree).

FIGS. 6 and 7 show embodiments to which the present disclosure isapplied, FIG. 6 is a schematic block diagram of a transform andquantization unit, and an inverse quantization and inverse transformunit in an encoding apparatus and FIG. 7 is a schematic block diagram ofan inverse quantization and inverse transform unit in a decodingapparatus.

FIG. 8 is a flowchart showing a process in which adaptive multipletransform (AMT) is performed.

FIG. 9 is a flowchart showing a decoding process in which AMT isperformed.

FIG. 10 is a flowchart showing an inverse transform process on the basisof MTS according to an embodiment of the present disclosure.

FIG. 11 is a block diagram of an apparatus for performing decoding onthe basis of MTS according to an embodiment of the present disclosure.

FIGS. 12 and 13 are flowcharts showing encoding/decoding to whichsecondary transform is applied as an embodiment to which presentdisclosure is applied.

FIGS. 14 and 15 show an embodiment to which the present disclosure isapplied, FIG. 14 is a diagram for describing Givens rotation and FIG. 15shows a configuration of one round in 4×4 non-separable secondarytransform (NSST) composed of Givens rotation layers and permutations.

FIG. 16 shows operation of reduced secondary transform (RST) as anembodiment to which the present disclosure is applied.

FIG. 17 is a diagram showing a process of performing reverse scanningfrom the sixty-fourth coefficient to the seventeenth coefficient inreverse scanning order as an embodiment to which the present disclosureis applied.

FIG. 18 is an exemplary flowchart showing encoding using a singletransform indicator (STI) as an embodiment to which the presentdisclosure is applied.

FIG. 19 is an exemplary flowchart showing encoding using a unifiedtransform indicator (UTI) as an embodiment to which the presentdisclosure is applied.

FIGS. 20A and 20B illustrates two exemplary flowcharts showing encodingusing a UTI as an embodiment to which the present disclosure is applied.

FIG. 21 is an exemplary flowchart showing encoding for performingtransform as an embodiment to which the present disclosure is applied.

FIG. 22 is an exemplary flowchart showing decoding for performingtransform as an embodiment to which the present disclosure is applied.

FIG. 23 is a detailed block diagram showing an example of a transformunit 120 in an encoding apparatus 100 as an embodiment to which thepresent disclosure is applied.

FIG. 24 is a detailed block diagram showing an example of an inversetransform unit 230 in a decoding apparatus 200 as an embodiment to whichthe present disclosure is applied.

FIG. 25 is a flowchart for processing a video signal as an embodiment towhich the present disclosure is applied.

FIG. 26 is a flow chart illustrating a method for transforming a videosignal according to an embodiment to which the present disclosure isapplied.

FIG. 27 is a diagram illustrating a method for encoding a video signalusing reduced transform as an embodiment to which the present disclosureis applied.

FIG. 28 is a diagram illustrating a method for decoding a video signalusing reduced transform as an embodiment to which the present disclosureis applied.

FIG. 29 is an example of a case where a separable transform is appliedaccording to an embodiment of the present disclosure. FIG. 29Aillustrates a region where a significant coefficient is present and aregion where zero-out is applied upon forward transform. FIG. 29Billustrates a region where a significant coefficient is present and aregion where zero-out is applied upon backward transform.

FIG. 30 illustrates an example of a flowchart for encoding a videosignal according to an embodiment of the present disclosure.

FIG. 31 illustrates an example of a flowchart for decoding a videosignal according to an embodiment of the present disclosure.

FIG. 32 is an embodiment to which the present disclosure is applied andillustrates an example of a block diagram of an apparatus for processinga video signal.

MODE FOR INVENTION

Some embodiments of the present disclosure are described in detail withreference to the accompanying drawings. A detailed description to bedisclosed along with the accompanying drawings are intended to describesome embodiments of the present disclosure and are not intended todescribe a sole embodiment of the present disclosure. The followingdetailed description includes more details in order to provide fullunderstanding of the present disclosure. However, those skilled in theart will understand that the present disclosure may be implementedwithout such more details.

In some cases, in order to avoid that the concept of the presentdisclosure becomes vague, known structures and devices are omitted ormay be shown in a block diagram form based on the core functions of eachstructure and device.

Although most terms used in the present disclosure have been selectedfrom general ones widely used in the art, some terms have beenarbitrarily selected by the applicant and their meanings are explainedin detail in the following description as needed. Thus, the presentdisclosure should be understood with the intended meanings of the termsrather than their simple names or meanings.

Specific terms used in the following description have been provided tohelp understanding of the present disclosure, and the use of suchspecific terms may be changed in various forms without departing fromthe technical sprit of the present disclosure. For example, signals,data, samples, pictures, frames, blocks and the like may beappropriately replaced and interpreted in each coding process.

In the present description, a “processing unit” refers to a unit inwhich an encoding/decoding process such as prediction, transform and/orquantization is performed. Further, the processing unit may beinterpreted into the meaning including a unit for a luma component and aunit for a chroma component. For example, the processing unit maycorrespond to a block, a coding unit (CU), a prediction unit (PU) or atransform unit (TU).

In addition, the processing unit may be interpreted into a unit for aluma component or a unit for a chroma component. For example, theprocessing unit may correspond to a coding tree block (CTB), a codingblock (CB), a PU or a transform block (TB) for the luma component.Further, the processing unit may correspond to a CTB, a CB, a PU or a TBfor the chroma component. Moreover, the processing unit is not limitedthereto and may be interpreted into the meaning including a unit for theluma component and a unit for the chroma component.

In addition, the processing unit is not necessarily limited to a squareblock and may be configured as a polygonal shape having three or morevertexes.

Furthermore, in the present description, a pixel is called a sample. Inaddition, using a sample may mean using a pixel value or the like.

FIG. 1 shows an example of a video coding system as an embodiment towhich the present disclosure is applied.

The video coding system may include a source device 10 and a receivedevice 20. The source device 10 can transmit encoded video/imageinformation or data to the receive device 20 in the form of a file orstreaming through a digital storage medium or a network.

The source device 10 may include a video source 11, an encodingapparatus 12, and a transmitter 13. The receive device 20 may include areceiver, a decoding apparatus 22 and a renderer 23. The encodingapparatus 12 may be called a video/image encoding apparatus and thedecoding apparatus 20 may be called a video/image decoding apparatus.The transmitter 13 may be included in the encoding apparatus 12. Thereceiver 21 may be included in the decoding apparatus 22. The renderer23 may include a display and the display may be configured as a separatedevice or an external component.

The video source can acquire a video/image through video/imagecapturing, combining or generating process. The video source may includea video/image capture device and/or a video/image generation device. Thevideo/image capture device may include, for example, one or morecameras, a video/image archive including previously capturedvideos/images, and the like. The video/image generation device mayinclude, for example, a computer, a tablet, a smartphone, and the likeand (electronically) generate a video/image. For example, a virtualvideo/image can be generated through a computer or the like and, in thiscase, a video/image capture process may be replaced with a related datageneration process.

The encoding apparatus 12 can encode an input video/image. The encodingapparatus 12 can perform a series of procedures such as prediction,transform and quantization for compression and coding efficiency.Encoded data (encoded video/image information) can be output in the formof a bitstream.

The transmitter 13 can transmit encoded video/image information or dataoutput in the form of a bitstream to the receiver of the receive devicein the form of a file or streaming through a digital storage medium or anetwork. The digital storage medium may include various storage mediasuch as a USB, an SD, a CD, a DVD, Blueray, an HDD, and an SSD. Thetransmitter 13 may include an element for generating a media filethrough a predetermined file format and an element for transmissionthrough a broadcast/communication network. The receiver 21 can extract abitstream and transmit the bitstream to the decoding apparatus 22.

The decoding apparatus 22 can decode a video/image by performing aseries of procedures such as inverse quantization, inverse transform andprediction corresponding to operation of the encoding apparatus 12.

The renderer 23 can render the decoded video/image. The renderedvideo/image can be display through a display.

FIG. 2 is a schematic block diagram of an encoding apparatus whichencodes a video/image signal as an embodiment to which the presentdisclosure is applied. The encoding apparatus 100 may correspond to theencoding apparatus 12 of FIG. 1.

An image partitioning unit 110 can divide an input image (or a pictureor a frame) input to the encoding apparatus 100 into one or moreprocessing units. For example, the processing unit may be called acoding unit (CU). In this case, the coding unit can be recursivelysegmented from a coding tree unit (CTU) or a largest coding unit (LCU)according to a quad-tree binary-tree (QTBT) structure. For example, asingle coding unit can be segmented into a plurality of coding unitswith a deeper depth on the basis of the quad-tree structure and/or thebinary tree structure. In this case, the quad-tree structure may beapplied first and then the binary tree structure may be applied.Alternatively, the binary tree structure may be applied first. A codingprocedure according to the present disclosure can be performed on thebasis of a final coding unit that is no longer segmented. In this case,a largest coding unit may be directly used as the final coding unit orthe coding unit may be recursively segmented into coding units with adeeper depth and a coding unit having an optimal size may be used as thefinal coding unit as necessary on the basis of coding efficiencyaccording to image characteristics. Here, the coding procedure mayinclude procedures such as prediction, transform and reconstructionwhich will be described later. Alternatively, the processing unit mayfurther include a prediction unit (PU) or a transform unit (TU). In thiscase, the prediction unit and the transform unit can be segmented orpartitioned from the aforementioned final coding unit. The predictionunit may be a unit of sample prediction and the transform unit may be aunit of deriving a transform coefficient and/or a unit of deriving aresidual signal from a transform coefficient.

A unit may be interchangeably used with the term “block” or “area”.Generally, an M×N block represents a set of samples or transformcoefficients in M columns and N rows. A sample can generally represent apixel or a pixel value and may represent only a pixel/pixel value of aluma component or only a pixel/pixel value of a chroma component. Thesample can be used as a term corresponding to a picture (image), a pixelor a pel.

The encoding apparatus 100 may generate a residual signal (a residualblock or a residual sample array) by subtracting a predicted signal (apredicted block or a predicted sample array) output from aninter-prediction unit 180 or an intra-prediction unit 185 from an inputvideo signal (an original block or an original sample array), and thegenerated residual signal is transmitted to the transform unit 120. Inthis case, a unit which subtracts the predicted signal (predicted blockor predicted sample array) from the input video signal (original blockor original sample array) in the encoder 100 may be called a subtractor115, as shown. A predictor can perform prediction on a processing targetblock (hereinafter referred to as a current block) and generate apredicted block including predicted samples with respect to the currentblock. The predictor can determine whether intra-prediction orinter-prediction is applied to the current block or units of CU. Thepredictor can generate various types of information about prediction,such as prediction mode information, and transmit the information to anentropy encoding unit 190 as described later in description of eachprediction mode. Information about prediction can be encoded in theentropy encoding unit 190 and output in the form of a bitstream.

The intra-prediction unit 185 can predict a current block with referenceto samples in a current picture. Referred samples may neighbor thecurrent block or may be separated therefrom according to a predictionmode. In intra-prediction, prediction modes may include a plurality ofnondirectional modes and a plurality of directional modes. Thenondirectional modes may include a DC mode and a planar mode, forexample. The directional modes may include, for example, 33 directionalprediction modes or 65 directional prediction modes according to adegree of minuteness of prediction direction. However, this is exemplaryand a number of directional prediction modes equal to or greater than 65or equal to or less than 33 may be used according to settings. Theintra-prediction unit 185 may determine a prediction mode to be appliedto the current block using a prediction mode applied to neighbor blocks.

The inter-prediction unit 180 can derive a predicted block with respectto the current block on the basis of a reference block (reference samplearray) specified by a motion vector on a reference picture. Here, toreduce the quantity of motion information transmitted in aninter-prediction mode, motion information can be predicted in units ofblock, subblock or sample on the basis of correlation of motioninformation between a neighboring block and the current block. Themotion information may include a motion vector and a reference pictureindex. The motion information may further include inter-predictiondirection (L0 prediction, L1 prediction, Bi prediction, etc.)information. In the case of inter-prediction, neighboring blocks mayinclude a spatial neighboring block present in a current picture and atemporal neighboring block present in a reference picture. The referencepicture including the reference block may be the same as or differentfrom the reference picture including the temporal neighboring block. Thetemporal neighboring block may be called a collocated reference block ora collocated CU (colCU) and the reference picture including the temporalneighboring block may be called a collocated picture (colPic). Forexample, the inter-prediction unit 180 may form a motion informationcandidate list on the basis of neighboring blocks and generateinformation indicating which candidate is used to derive a motion vectorand/or a reference picture index of the current block. Inter-predictioncan be performed on the basis of various prediction modes, and in thecase of a skip mode and a merge mode, the inter-prediction unit 180 canuse motion information of a neighboring block as motion information ofthe current block. In the case of the skip mode, a residual signal maynot be transmitted differently from the merge mode. In the case of amotion vector prediction (MVP) mode, the motion vector of the currentblock can be indicated by using a motion vector of a neighboring blockas a motion vector predictor and signaling a motion vector difference.

A predicted signal generated through the inter-prediction unit 180 orthe intra-prediction unit 185 can be used to generate a reconstructedsignal or a residual signal.

The transform unit 120 can generate transform coefficients by applying atransform technique to a residual signal. For example, the transformtechnique may include at least one of DCT (Discrete Cosine Transform),DST (Discrete Sine Transform), KLT (Karhunen-Loeve Transform), GBT(Graph-Based Transform) and CNT (Conditionally Non-linear Transform).Here, GBT refers to transform obtained from a graph representinginformation on relationship between pixels. CNT refers to transformobtained on the basis of a predicted signal generated using allpreviously reconstructed pixels. Further, the transform process may beapplied to square pixel blocks having the same size or applied tonon-square blocks having variable sizes.

A quantization unit 130 may quantize transform coefficients and transmitthe quantized transform coefficients to the entropy encoding unit 190,and the entropy encoding unit 190 may encode a quantized signal(information about the quantized transform coefficients) and output theencoded signal as a bitstream. The information about the quantizedtransform coefficients may be called residual information. Thequantization unit 130 may rearrange the quantized transform coefficientsin the form of a block into the form of a one-dimensional vector on thebasis of a coefficient scanning order and generate information about thequantized transform coefficients on the basis of the quantized transformcoefficients in the form of a one-dimensional vector. The entropyencoding unit 190 can execute various encoding methods such asexponential Golomb, CAVLC (context-adaptive variable length coding) andCABAC (context-adaptive binary arithmetic coding), for example. Theentropy encoding unit 190 may encode information necessary forvideo/image reconstruction (e.g., values of syntax elements and thelike) along with or separately from the quantized transformcoefficients. Encoded information (e.g., video/image information) may betransmitted or stored in the form of a bitstream in unit of networkabstraction layer (NAL) unit. The bitstream may be transmitted through anetwork or stored in a digital storage medium. Here, the network mayinclude a broadcast network and/or a communication network and thedigital storage medium may include various storage media such as a USB,an SD, a CD, a DVD, Blueray, an HDD and an SSD. A transmitter (notshown) which transmits the signal output from the entropy encoding unit190 and/or a storage (not shown) which stores the signal may beconfigured as internal/external elements of the encoding apparatus 100,and the transmitter may be a component of the entropy encoding unit 190.

The quantized transform coefficients output from the quantization unit130 can be used to generate a predicted signal. For example, a residualsignal can be reconstructed by applying inverse quantization and inversetransform to the quantized transform coefficients through an inversequantization unit 140 and an inverse transform unit 150 in the loop. Anadder 155 can add the reconstructed residual signal to the predictedsignal output from the inter-prediction unit 180 or the intra-predictionunit 185 such that a reconstructed signal (reconstructed picture,reconstructed block or reconstructed sample array) can be generated.When there is no residual with respect to a processing target block asin a case in which the skip mode is applied, a predicted block can beused as a reconstructed block. The adder 155 may also be called areconstruction unit or a reconstructed block generator. The generatedreconstructed signal can be used for intra-prediction of the nextprocessing target block in the current picture or used forinter-prediction of the next picture through filtering which will bedescribed later.

A filtering unit 160 can improve subjective/objective picture quality byapplying filtering to the reconstructed signal. For example, thefiltering unit 160 can generate a modified reconstructed picture byapplying various filtering methods to the reconstructed picture andtransmit the modified reconstructed picture to a decoded picture buffer170. The various filtering methods may include, for example, deblockingfiltering, sample adaptive offset (SAO), adaptive loop filtering (ALF),and bilateral filtering. The filtering unit 160 can generate varioustypes of information about filtering and transmit the information to theentropy encoding unit 190 as will be described later in description ofeach filtering method. Information about filtering may be encoded in theentropy encoding unit 190 and output in the form of a bitstream.

The modified reconstructed picture transmitted to the decoded picturebuffer 170 can be used as a reference picture in the inter-predictionunit 180. Accordingly, the encoding apparatus can avoid mismatch betweenthe encoding apparatus 100 and the decoding apparatus and improveencoding efficiency when inter-prediction is applied.

The decoded picture buffer 170 can store the modified reconstructedpicture such that the modified reconstructed picture is used as areference picture in the inter-prediction unit 180.

FIG. 3 is a schematic block diagram of a decoding apparatus whichperforms decoding of a video signal as an embodiment to which thepresent disclosure is applied. The decoding apparatus 200 of FIG. 3corresponds to the decoding apparatus 22 of FIG. 1.

Referring to FIG. 3, the decoding apparatus 200 may include an entropydecoding unit 210, an inverse quantization unit 220, an inversetransform unit 230, an adder 235, a filtering unit 240, a decodedpicture buffer (DPB) 250, an inter-prediction unit 260, and anintra-prediction unit 265. The inter-prediction unit 260 and theintra-prediction unit 265 may be collectively called a predictor. Thatis, the predictor can include the inter-prediction unit 180 and theintra-prediction unit 185. The inverse quantization unit 220 and theinverse transform unit 230 may be collectively called a residualprocessor. That is, the residual processor can include the inversequantization unit 220 and the inverse transform unit 230. Theaforementioned entropy decoding unit 210, inverse quantization unit 220,inverse transform unit 230, adder 235, filtering unit 240,inter-prediction unit 260 and intra-prediction unit 265 may beconfigured as a single hardware component (e.g., a decoder or aprocessor) according to an embodiment. Further, the decoded picturebuffer 250 may be configured as a single hardware component (e.g., amemory or a digital storage medium) according to an embodiment.

When a bitstream including video/image information is input, thedecoding apparatus 200 can reconstruct an image through a processcorresponding to the process of processing the video/image informationin the encoding apparatus 100 of FIG. 2. For example, the decodingapparatus 200 can perform decoding using a processing unit applied inthe encoding apparatus 100. Accordingly, a processing unit of decodingmay be a coding unit, for example, and the coding unit can be segmentedfrom a coding tree unit or a largest coding unit according to a quadtree structure and/or a binary tree structure. In addition, areconstructed video signal decoded and output by the decoding apparatus200 can be reproduced through a reproduction apparatus.

The decoding apparatus 200 can receive a signal output from the encodingapparatus 100 of FIG. 2 in the form of a bitstream, and the receivedsignal can be decoded through the entropy decoding unit 210. Forexample, the entropy decoding unit 210 can parse the bitstream to deriveinformation (e.g., video/image information) necessary for imagereconstruction (or picture reconstruction). For example, the entropydecoding unit 210 can decode information in the bitstream on the basisof a coding method such as exponential Golomb, CAVLC or CABAC and outputsyntax element values necessary for image reconstruction and quantizedvalues of transform coefficients with respect to residual. Morespecifically, the CABAC entropy decoding method receives a bincorresponding to each syntax element in the bitstream, determines acontext model using decoding target syntax element information anddecoding information of neighboring and decoding target blocks orinformation on symbols/bins decoded in a previous stage, predicts bingeneration probability according to the determined context model andperforms arithmetic decoding of bins to generate a symbol correspondingto each syntax element value. Here, the CABAC entropy decoding methodcan update the context model using information on symbols/bins decodedfor the next symbol/bin context model after the context model isdetermined. Information about prediction among the information decodedin the entropy decoding unit 210 can be provided to the predictor(inter-prediction unit 260 and the intra-prediction unit 265) andresidual values on which entropy decoding has been performed in theentropy decoding unit 210, that is, quantized transform coefficients,and related parameter information can be input to the inversequantization unit 220. Further, information about filtering among theinformation decoded in the entropy decoding unit 210 can be provided tothe filtering unit 240. Meanwhile, a receiver (not shown) which receivesa signal output from the encoding apparatus 100 may be additionallyconfigured as an internal/external element of the decoding apparatus 200or the receiver may be a component of the entropy decoding unit 210.

The inverse quantization unit 220 can inversely quantize the quantizedtransform coefficients to output transform coefficients. The inversequantization unit 220 can rearrange the quantized transform coefficientsin the form of a two-dimensional block. In this case, rearrangement canbe performed on the basis of the coefficient scanning order in theencoding apparatus 100. The inverse quantization unit 220 can performinverse quantization on the quantized transform coefficients using aquantization parameter (e.g., quantization step size information) andacquire transform coefficients.

The inverse transform unit 230 inversely transforms the transformcoefficients to obtain a residual signal (residual block or residualsample array).

The predictor can perform prediction on a current block and generate apredicted block including predicted samples with respect to the currentblock. The predictor can determine whether intra-prediction orinter-prediction is applied to the current block on the basis of theinformation about prediction output from the entropy decoding unit 210and determine a specific intra/inter-prediction mode.

The intra-prediction unit 265 can predict the current block withreference to samples in a current picture. The referred samples mayneighbor the current block or may be separated from the current blockaccording to a prediction mode. In intra-prediction, prediction modesmay include a plurality of nondirectional modes and a plurality ofdirectional modes. The intra-prediction 265 may determine a predictionmode applied to the current block using a prediction mode applied toneighboring blocks.

The inter-prediction unit 260 can derive a predicted block with respectto the current block on the basis of a reference block (reference samplearray) specified by a motion vector on a reference picture. Here, toreduce the amount of motion information transmitted in theinter-prediction mode, the motion information can be predicted in unitsof block, subblock or sample on the basis of correlation of the motioninformation between a neighboring block and the current block. Themotion information may include a motion vector and a reference pictureindex. The motion information may further include inter-predictiondirection (L0 prediction, L1 prediction, Bi prediction, etc.)information. In the case of inter-prediction, neighboring blocks mayinclude a spatial neighboring block present in a current picture and atemporal neighboring block present in a reference picture. For example,the inter-prediction unit 260 may form a motion information candidatelist on the basis of neighboring blocks and derive the motion vectorand/or the reference picture index of the current block on the basis ofreceived candidate selection information. Inter-prediction can beperformed on the basis of various prediction modes and the informationabout prediction may include information indicating the inter-predictionmode for the current block.

The adder 235 can generate a reconstructed signal (reconstructedpicture, reconstructed block or reconstructed sample array) by addingthe obtained residual signal to the predicted signal (predicted block orpredicted sample array) output from the inter-prediction unit 260 or theintra-prediction unit 265. When there is no residual with respect to theprocessing target block as in a case in which the skip mode is applied,the predicted block may be used as a reconstructed block.

The adder 235 may also be called a reconstruction unit or areconstructed block generator. The generated reconstructed signal can beused for intra-prediction of the next processing target block in thecurrent picture or used for inter-prediction of the next picture throughfiltering which will be described later.

The filtering unit 240 can improve subjective/objective picture qualityby applying filtering to the reconstructed signal. For example, thefiltering unit 240 can generate a modified reconstructed picture byapplying various filtering methods to the reconstructed picture andtransmit the modified reconstructed picture to a decoded picture buffer250. The various filtering methods may include, for example, deblockingfiltering, sample adaptive offset, adaptive loop filtering, andbilateral filtering.

The modified reconstructed picture transmitted to the decoded picturebuffer 250 can be used as a reference picture by the inter-predictionunit 260.

In the present description, embodiments described in the filtering unit160, the inter-prediction unit 180 and the intra-prediction unit 185 ofthe encoding apparatus 100 can be applied to the filtering unit 240, theinter-prediction unit 260 and the intra-prediction unit 265 of thedecoding apparatus equally or in a corresponding manner.

FIG. 4 is a configuration diagram of a content streaming system as anembodiment to which the present disclosure is applied.

The content streaming system to which the present disclosure is appliedmay include an encoding server 410, a streaming server 420, a web server430, a media storage 440, a user equipment 450, and multimedia inputdevices 460.

The encoding server 410 serves to compress content input from multimediainput devices such as a smartphone, a camera and a camcorder intodigital data to generate a bitstream and transmit the bitstream to thestreaming server 420. As another example, when the multimedia inputdevices 460 such as a smartphone, a camera and a camcorder directlygenerate bit streams, the encoding server 410 may be omitted.

The bitstream may be generated by an encoding method or a bitstreamgeneration method to which the present disclosure is applied and thestreaming server 420 can temporarily store the bitstream in the processof transmitting or receiving the bitstream.

The streaming server 420 transmits multimedia data to the user equipment450 on the basis of a user request through the web server 430 and theweb server 430 serves as a medium that informs a user of services. Whenthe user sends a request for a desired service to the web server 430,the web server 430 delivers the request to the streaming server 420 andthe streaming server 420 transmits multimedia data to the user. Here,the content streaming system may include an additional control server,and in this case, the control server serves to controlcommands/responses between devices in the content streaming system.

The streaming server 420 may receive content from the media storage 440and/or the encoding server 410. For example, when content is receivedfrom the encoding server 410, the streaming server 420 can receive thecontent in real time. In this case, the streaming server 420 may storebit streams for a predetermined time in order to provide a smoothstreaming service.

Examples of the user equipment 450 may include a cellular phone, asmartphone, a laptop computer, a digital broadcast terminal, a PDA(personal digital assistant), a PMP (portable multimedia player), anavigation device, a slate PC, a tablet PC, an ultrabook, a wearabledevice (e.g., a smartwatch, a smart glass and an HMD (head mounteddisplay)), a digital TV, a desktop computer, a digital signage, etc.

Each server in the content streaming system may be operated as adistributed server, and in this case, data received by each server canbe processed in a distributed manner.

FIG. 5 shows embodiments to which the present disclosure is applicable,FIG. 5A is a diagram for describing a block segmentation structureaccording to QT (Quad Tree), FIG. 5B is a diagram for describing a blocksegmentation structure according to BT (Binary Tree), FIG. 5C is adiagram for describing a block segmentation structure according to TT(Ternary Tree), FIG. 5D is a diagram for describing a block segmentationstructure according to AT (Asymmetric Tree).

In video coding, a single block can be segmented on the basis of QT.Further, a single subblock segmented according to QT can be furtherrecursively segmented using QT. A leaf block that is no longer segmentedaccording to QT can be segmented using at least one of BT, TT and AT. BTmay have two types of segmentation: horizontal BT (2N×N, 2N×N); andvertical BT (N×2N, N×2N). TT may have two types of segmentation:horizontal TT (2N×½N, 2N×N, 2N×½N); and vertical TT (½N×2N, N×2N,½N×2N). AT may have four types of segmentation: horizontal-up AT (2N×½N,2N×3/2N); horizontal-down AT (2N×3/2N, 2N×½N), vertical-left AT (½N×2N,3/2N×2N); and vertical-right AT (3/2N×2N, ½N×2N). Each type of BT, TTand AT can be further recursively segmented using BT, TT and AT.

FIG. 5A shows an example of QT segmentation. A block A can be segmentedinto four subblocks A0, A1, A2 and A3 according to QT. The subblock A1can be further segmented into four subblocks B0, B1, B2 and B3 accordingto QT.

FIG. 5B shows an example of BT segmentation. The block B3 that is nolonger segmented according to QT can be segmented into vertical BT (C0and C1) or horizontal BT (D0 and D1). Each subblock such as the block C0can be further recursively segmented into horizontal BT (E0 and E1) orvertical BT (F0 and F1).

FIG. 5C shows an example of TT segmentation. The block B3 that is nolonger segmented according to QT can be segmented into vertical TT (C0,C1 and C2) or horizontal TT (D0, D1 and D2). Each subblock such as theblock C1 can be further recursively segmented into horizontal TT (E0, E1and E2) or vertical TT (F0, F1 and F2).

FIG. 5D shows an example of AT segmentation. The block B3 that is nolonger segmented according to QT can be segmented into vertical AT (C0and C1) or horizontal AT (D0 and D1). Each subblock such as the block C1can be further recursively segmented into horizontal AT (E0 and E1) orvertical TT (F0 and F1).

Meanwhile, BT, TT and AT segmentation may be used in a combined manner.For example, a subblock segmented according to BT may be segmentedaccording to TT or AT. Further, a subblock segmented according to TT maybe segmented according to BT or AT. A subblock segmented according to ATmay be segmented according to BT or TT. For example, each subblock maybe segmented into vertical BT after horizontal BT segmentation or eachsubblock may be segmented into horizontal BT after vertical BTsegmentation. In this case, finally segmented shapes are identicalalthough segmentation orders are different.

Further, when a block is segmented, a block search order can be definedin various manners. In general, search is performed from left to rightand top to bottom, and block search may mean the order of determiningwhether each segmented subblock will be additionally segmented, anencoding order of subblocks when the subblocks are no longer segmented,or a search order when a subblock refers to information of neighboringother blocks.

Transform may be performed on processing units (or transform blocks)segmented according to the segmentation structures as shown in FIGS. 5Ato 5D, and particularly, segmentation may be performed in a rowdirection and a column direction and a transform matrix may be applied.According to an embodiment of the present disclosure, differenttransform types may be used according to the length of a processing unit(or transform block) in the row direction or column direction.

Transform is applied to residual blocks in order to decorrelate theresidual blocks as much as possible, concentrate coefficients on a lowfrequency and generate a zero tail at the end of a block. A transformpart in JEM software includes two principal functions (core transformand secondary transform). Core transform is composed of discrete cosinetransform (DCT) and discrete sine transform (DST) transform familiesapplied to all rows and columns of a residual block. Thereafter,secondary transform may be additionally applied to a top left corner ofthe output of core transform. Similarly, inverse transform may beapplied in the order of inverse secondary transform and inverse coretransform. First, inverse secondary transform can be applied to a topleft corner of a coefficient block. Then, inverse core transform isapplied to rows and columns of the output of inverse secondarytransform. Core transform or inverse transform may be referred to asprimary transform or inverse transform.

FIGS. 6 and 7 show embodiments to which the present disclosure isapplied, FIG. 6 is a schematic block diagram of a transform andquantization unit 120/130, and an inverse quantization and inversetransform unit 140/150 in the encoding apparatus 100 and FIG. 7 is aschematic block diagram of an inverse quantization and inverse transformunit 220/230 in the decoding apparatus 200.

Referring to FIG. 6, the transform and quantization unit 120/130 mayinclude a primary transform unit 121, a secondary transform unit 122 anda quantization unit 130. The inverse quantization and inverse transformunit 140/150 may include an inverse quantization unit 140, an inversesecondary transform unit 151 and an inverse primary transform unit 152.

Referring to FIG. 7, the inverse quantization and inverse transform unit220/230 may include an inverse quantization unit 220, an inversesecondary transform unit 231 and an inverse primary transform unit 232.

In the present disclosure, transform may be performed through aplurality of stages. For example, two states of primary transform andsecondary transform may be applied as shown in FIG. 6 or more than twotransform stages may be used according to algorithms. Here, primarytransform may be referred to core transform.

The primary transform unit 121 can apply primary transform to a residualsignal. Here, primary transform may be predefined by a table in anencoder and/or a decoder.

The secondary transform unit 122 can apply secondary transform to aprimarily transformed signal. Here, secondary transform may bepredefined by a table in the encoder and/or the decoder.

In an embodiment, non-separable secondary transform (NSST) may beconditionally applied as secondary transform. For example, NSST isapplied only to intra-prediction blocks and may have a transform setapplicable per prediction mode group.

Here, a prediction mode group can be set on the basis of symmetry withrespect to a prediction direction. For example, prediction mode 52 andprediction mode 16 are symmetrical on the basis of prediction mode 34(diagonal direction), and thus one group can be generated and the sametransform set can be applied thereto. Here, when transform forprediction mode 52 is applied, input data is transposed and thentransform is applied because a transform set of prediction mode 52 isthe same as that of prediction mode 16.

In the case of the planar mode and the DC mode, there is no symmetrywith respect to directions and thus they have respective transform setsand a corresponding transform set may be composed of two transforms.Each transform set may be composed of three transforms for the remainingdirectional modes.

The quantization unit 130 can perform quantization on a secondarilytransformed signal.

The inverse quantization and inverse transform unit 140/150 performs thereverse of the aforementioned procedure and redundant description isomitted.

FIG. 7 is a schematic block diagram of the inverse quantization andinverse transform unit 220/230 in the decoding apparatus 200.

Referring to FIG. 7, the inverse quantization and inverse transform unit220/230 may include the inverse quantization unit 220, the inversesecondary transform unit 231 and the inverse primary transform unit 232.

The inverse quantization unit 220 obtains transform coefficients from anentropy-decoded signal using quantization step size information.

The inverse secondary transform unit 231 performs inverse secondarytransform on the transform coefficients. Here, inverse secondarytransform refers to inverse transform of secondary transform describedin FIG. 6.

The inverse primary transform unit 232 performs inverse primarytransform on the inversely secondarily transformed signal (or block) andobtains a residual signal. Here, inverse primary transform refers toinverse transform of primary transform described in FIG. 6.

In addition to DCT-2 and 4×4 DST-4 applied to HEVC, adaptive multipletransform or explicit multiple transform (AMT or EMT) is used forresidual coding for inter- and intra-coded blocks. A plurality oftransforms selected from DCT/DST families is used in addition totransforms in HEVC. Transform matrices newly introduced in JEM areDST-7, DCT-8, DST-1, and DCT-5. The following table 1 shows basicfunctions of selected DST/DCT.

TABLE 1 Transform Type Basis function T_(i)(j), i, j = 0, 1, . . . , N −1 DCT-II${{T_{i}(j)} = {{\omega_{0} \cdot \sqrt{\frac{2}{N}} \cdot \cos}\mspace{11mu}\left( \frac{\pi \cdot i \cdot \left( {{2j} + 1} \right)}{2N} \right)}}\;$${{where}\mspace{14mu}\omega_{0}} = \left\{ \begin{matrix}\sqrt{\frac{2}{N}} & {i = 0} \\1 & {i \neq 0}\end{matrix} \right.$ DCT-V${{T_{i}(j)} = {{\omega_{0} \cdot \omega_{1} \cdot \sqrt{\frac{2}{{2N} - 1}} \cdot \cos}\mspace{11mu}\left( \frac{2{\pi \cdot i \cdot j}}{{2N} - 1} \right)}},$${{where}\mspace{14mu}\omega_{0}} = \left\{ {\begin{matrix}\sqrt{\frac{2}{N}} & {i = 0} \\1 & {i \neq 0}\end{matrix},{\omega_{1} = \left\{ \begin{matrix}\sqrt{\frac{2}{N}} & {j = 0} \\1 & {j \neq 0}\end{matrix} \right.}} \right.$ DCT-VIII${T_{i}(j)} = {{\sqrt{\frac{4}{{2N} + 1}} \cdot \cos}\mspace{11mu}\left( \frac{\pi \cdot \left( {{2i} + 1} \right) \cdot \left( {{2j} + 1} \right)}{{4N} + 2} \right)}$DST-I${T_{i}(j)} = {{\sqrt{\frac{2}{N + 1}} \cdot \sin}\mspace{11mu}\left( \frac{\pi \cdot \left( {i + 1} \right) \cdot \left( {j + 1} \right)}{N + 1} \right)}$DST-VII${T_{i}(j)} = {{\sqrt{\frac{4}{{2N} + 1}} \cdot \sin}\mspace{11mu}\left( \frac{\pi \cdot \left( {{2i} + 1} \right) \cdot \left( {j + 1} \right)}{{2N} + 1} \right)}$

EMT can be applied to CUs having a width and height equal to or lessthan 64 and whether EMT is applied can be controlled by a CU level flag.When the CU level flag is 0, DCT-2 is applied to CUs in order to encoderesidue. Two additional flags are signaled in order to identifyhorizontal and vertical transforms to be used fora luma coding block ina CU to which EMT is applied. As in HEVC, residual of a block can becoded in a transform skip mode in JEM. For intra-residual coding, amode-dependent transform candidate selection process is used due toother residual statistics of other intra-prediction modes. Threetransform subsets are defined as shown in the following table 2 and atransform subset is selected on the basis of an intra-prediction mode asshown in Table 3.

TABLE 2 Transform Set Transform Candidates 0 DST-VII, DCT-VIII 1DST-VII, DST-I 2 DST-VII, DCT-VIII

Along with the subset concept, a transform subset is initially confirmedon the basis of Table 2 by using the intra-prediction mode of a CUhaving a CU-level EMT_CU_flag of 1. Thereafter, for each of horizontalEMT_TU_horizontal_flag) and vertical (EMT_TU_vertical_flag) transforms,one of two transform candidates in the confirmed transform subset isselected on the basis of explicit signaling using flags according toTable 3.

TABLE 3 Intra Mode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 V 2 1 0 10 1 0 1 0 1 0 1 0 1 0 0 0 0 H 2 1 0 1 0 1 0 1 0 1 0 1 0 1 2 2 2 2 IntraMode 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 V 0 0 0 0 0 10 1 0 1 0 1 0 1 0 1 0 1 H 2 2 2 2 2 1 0 1 0 1 0 1 0 1 0 1 0 1 Intra Mode36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 V 0 1 0 1 0 1 0 10 1 2 2 2 2 2 2 2 2 H 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 Intra Mode 5455 56 57 58 59 60 61 62 63 64 65 66 V 2 1 0 1 0 1 0 1 0 1 0 1 0 H 0 1 01 0 1 0 1 0 1 0 1 0

TABLE 4 Horizontal Vertical 35 intra 67 intra Configuration (row)(column) Prediction Prediction Group transform transform modes modesGroup 0 0 DST7 DST7 0 0 (G0) 1 DCT5 DST7 2 DST7 DCT5 3 DCT5 DCT5 Group 10 DST7 DST7 1, 3, 5, 7, 1, 3, 5, 7, 9, (G1) 1 DST1 DST7 13, 15, 17, 11,13, 23, 2 DST7 DST1 19, 21, 23, 25, 27, 29, 31, 3 DST1 DST1 29, 31, 3333, 35, 37, 39, 41, 43, 45, 55, 57, 59, 61, 63, 65 Group 2 0 DST7 DST72, 4, 6, 14, 2, 4, 6, 8, 10, (G2) 1 DCT8 DST7 16, 18, 20, 12, 24, 26,28, 2 DST7 DCT8 22, 30, 32, 34 30, 32, 34, 36, 3 DCT8 DCT8 38, 40, 42,44, 56, 58, 60, 64, 66 Group 3 0 DST7 DST7 8, 9, 10, 11, 14, 15, 16, 17,(G3) 1 DCT5 DST7 12 18, 19, 20, 2 DST7 DCT8 (Neighboring 21, 22 3 DCT5DCT8 angles to (Neighboring horizontal angles to directions) horizontaldirections) Group 4 0 DST7 DST7 24, 25, 26, 46, 47, 48, 49, (G4) 1 DCT8DST7 27, 28 50, 51, 52, 53, 2 DST7 DCT5 (Neighboring 54 3 DCT8 DCT5angles to (Neighboring vertical angles to directions) verticaldirections) Group 5 0 DCT8 DCT8 Inter prediction Inter prediction (G5) 1DST7 DCT8 2 DCT8 DST7 3 DST7 DST7

Table 4 shows a transform configuration group to which adaptive multipletransform (AMT) is applied as an embodiment to which the presentdisclosure is applied.

Referring to Table 4, transform configuration groups are determined onthe basis of a prediction mode and the number of groups may be 6 (G0 toG5). In addition, G0 to G4 correspond to a case in whichintra-prediction is applied and G5 represents transform combinations (ortransform set or transform combination set) applied to a residual blockgenerated according to inter-prediction.

One transform combination may be composed of horizontal transform (orrow transform) applied to rows of a corresponding 2D block and verticaltransform (or column transform) applied to columns thereof.

Here, each of the transform configuration groups may have four transformcombination candidates. The four transform combination candidates may beselected or determined using transform combination indexes 0 to 3 and atransform combination index may be encoded and transmitted from anencoder to a decoder.

In an embodiment, residual data (or residual signal) obtained throughintra-prediction may have different statistical characteristicsaccording to intra-prediction modes. Accordingly, transforms other thannormal cosine transform may be applied for respective intra-predictionsas shown in Table 4. In the present description, a transform type may berepresented as DCT-Type 2, DCT-II or DCT-2, for example.

Referring to Table 4, a case in which 35 intra-prediction modes are usedand a case in which 67 intra-prediction modes are used are shown. Aplurality of transform combinations may be applied for each transformconfiguration group classified in each intra-prediction mode column. Forexample, a plurality of transform combinations may be composed of fourcombinations (of transforms in the row direction and transforms in thecolumn direction). As a specific example, DST-7 and DCT-5 can be appliedto group 0 in both the row (horizontal) direction and the column(vertical) direction and thus a total of four groups can be applied.

Since a total of four transform kernel combinations can be applied toeach intra-prediction mode, a transform combination index for selectingone therefrom can be transmitted per transform unit. In the presentdescription, a transform combination index may be referred to as an AMTindex and may be represented by amt_idx.

Furthermore, a case in which DCT-2 is optimal for both the row directionand the column direction may be generated due to characteristics of aresidual signal in addition to the transform kernels shown in Table 4.Accordingly, transform can be adaptively applied by defining an AMT flagfor each coding unit. Here, DCT-2 can be applied to both the rowdirection and the column direction when the AMT flag is 0 and one offour combinations can be selected or determined through an AMT indexwhen the AMT flag is 1.

In an embodiment, if the number of transform coefficients is less than 3for one transform unit when the AMT flag is 0, the transform kernels ofTable 4 is not applied and DST-7 may be applied to both the rowdirection and the column direction.

In an embodiment, if transform coefficient values are previously parsedand thus the number of transform coefficients is less than 3, an AMTindex is not parsed and DST-7 is applied and thus the amount oftransmission of additional information can be reduced.

In an embodiment, AMT can be applied only when both the width and heightof a transform unit are equal to or less than 32.

In an embodiment, Table 4 can be preset through off-line training.

In an embodiment, the AMT index can be defined as one index that canindicate a combination of horizontal transform and vertical transform.Alternatively, the AMT index can be defined as separate horizontaltransform index and vertical transform index.

FIG. 8 is a flowchart showing a process of performing adaptive multipletransform (AMT).

Although an embodiment with respect to separable transform that isseparately applied in the horizontal direction and the verticaldirection is basically described in the present description, a transformcombination may be composed of non-separable transforms.

Alternatively, a transform combination may be configured as a mixture ofseparable transforms and non-separable transforms. In this case,row/column-wise transform selection or selection in thehorizontal/vertical direction is unnecessary when separable transform isused and the transform combinations of Table 4 can be used only whenseparable transform is selected.

In addition, methods proposed in the present description can be appliedirrespective of primary transform and secondary transform. That is, themethods can be applied to both the transforms. Here, primary transformcan refer to transform for initially transforming a residual block andsecondary transform can refer to transform for applying transform to ablock generated as a result of primary transform.

First, the encoding apparatus 100 can determine a transform groupcorresponding to a current block (S805). Here, the transform group mayrefer to a transform group of Table 4 but the present disclosure is notlimited thereto and the transform group may be composed of othertransform combinations.

The encoding apparatus 100 can perform transform on available candidatetransform combinations in the transform group (S810). As a result oftransform, the encoding apparatus 100 can determine or select atransform combination with a lowest rate distortion (RD) cost (S815).The encoding apparatus 100 can encode a transform combination indexcorresponding to the selected transform combination (S820).

FIG. 9 is a flowchart showing a decoding process of performing AMT.

First, the decoding apparatus 200 can determine a transform group forthe current block (S905). The decoding apparatus 200 can parse atransform combination index, and the transform combination index cancorrespond to one of a plurality of transform combinations in thetransform group (S910). The decoding apparatus 200 can derive atransform combination corresponding to the transform combination index(S915). Here, although the transform combination may refer to atransform combination shown in Table 4, the present disclosure is notlimited thereto. That is, the transform combination may be configured asother transform combinations.

The decoding apparatus 200 can perform inverse transform on the currentblock on the basis of the transform combination (S920). When thetransform combination is composed of row transform and column transform,row transform may be applied and then column transform may be applied.However, the present disclosure is not limited thereto, and rowtransform may be applied after column transform is applied, and when thetransform combination is composed of non-separable transforms, anon-separable transform can be immediately applied.

In another embodiment, the process of determining a transform group andthe process of parsing a transform combination index may besimultaneously performed.

In the embodiment of the present disclosure, the aforementioned term“AMT” may be redefined as “multiple transform set or multiple transformselection (MTS)”. MTS related syntaxes and semantics described below aresummarized in Versatile Video coding (WC) JVET-K1001-v4.

In an embodiment of the present disclosure, two MTS candidates can beused for directional modes and four MTS candidates can be used fornondirectional modes as follows.

A) Nondirectional Modes (DC and Planar)

DST-7 is used for horizontal and vertical transforms when MTS index is0.

DST-7 is used for vertical transform and DCT-8 is used for horizontaltransforms when MTS index is 1.

DCT-8 is used for vertical transform and DST-7 is used for horizontaltransforms when MTS index is 2.

DCT-8 is used for horizontal and vertical transforms when MTS index is3.

B) Modes Belonging to Horizontal Group Modes

DST-7 is used for horizontal and vertical transforms when MTS index is0.

DCT-8 is used for vertical transform and DST-7 is used for horizontaltransforms when MTS index is 1.

C) Modes Belonging to Vertical Group Modes

DST-7 is used for horizontal and vertical transforms when MTS index is0.

DST-7 is used for vertical transform and DCT-8 is used for horizontaltransforms when MTS index is 1.

Here (In VTM 2.0 in which 67 modes are used), horizontal group modesinclude intra-prediction modes 2 to 34 and vertical modes includeintra-prediction modes 35 to 66.

In another embodiment of the present disclosure, three MTS candidatesare used for all intra-prediction modes.

DST-7 is used for horizontal and vertical transforms when MTS index is0.

DST-7 is used for vertical transform and DCT-8 is used for horizontaltransforms when MTS index is 1.

DCT-8 is used for vertical transform and DST-7 is used for horizontaltransforms when MTS index is 2.

In another embodiment of the present disclosure, two MTS candidates areused for directional prediction modes and three MTS candidates are usedfor nondirectional modes.

A) Nondirectional Modes (DC and Planar)

DST-7 is used for horizontal and vertical transforms when MTS index is0.

DST-7 is used for vertical transform and DCT-8 is used for horizontaltransforms when MTS index is 1.

DCT-8 is used for vertical transform and DST-7 is used for horizontaltransforms when MTS index is 2.

B) Prediction Modes Corresponding to Horizontal Group Modes

DST-7 is used for horizontal and vertical transforms when MTS index is0.

DCT-8 is used for vertical transform and DST-7 is used for horizontaltransforms when MTS index is 1.

C) Prediction Modes Corresponding to Vertical Group Modes

DST-7 is used for horizontal and vertical transforms when MTS index is0.

DST-7 is used for vertical transform and DCT-8 is used for horizontaltransforms when MTS index is 1.

In another embodiment of the present disclosure, one MTS candidate(e.g., DST-7) can be used for all intra-modes. In this case, encodingtime can be reduced by 40% with some minor coding loss. In addition, oneflag may be used to indicate between DCT-2 and DST-7.

FIG. 10 is a flowchart showing an inverse transform process on the basisof MTS according to an embodiment of the present disclosure.

The decoding apparatus 200 to which the present disclosure is appliedcan obtain sps_mts_intra_enabled_flag or sps_mts_inter_enabled_flag(S1005). Here, sps_mts_intra_enabled_flag indicates whether cu_mts_flagis present in a residual coding syntax of an intra-coding unit. Forexample, cu_mts_flag is not present in the residual coding syntax of theintra-coding unit if sps_mts_intra_enabled_flag=0 and cu_mts_flag ispresent in the residual coding syntax of the intra-coding unit if,sps_mts_intra_enabled_flag=1. In addition, sps_mts_inter_enabled_flagindicates whether cu_mts_flag is present in a residual coding syntax ofan inter-coding unit. For example, cu_mts_flag is not present in theresidual coding syntax of the inter-coding unit ifsps_mts_inter_enabled_flag=0 and cu_mts_flag is present in the residualcoding syntax of the inter-coding unit if sps_mts_inter_enabled_flag=1.

The decoding apparatus 200 can obtain cu_mts_flag on the basis ofsps_mts_intra_enabled_flag or sps_mts_inter_enabled_flag (S1010). Forexample, the decoding apparatus 200 can obtain cu_mts_flag whensps_mts_intra_enabled_flag=1 or sps_mts_inter_enabled_flag=1. Here,cu_mts_flag indicates whether MTS is applied to a residual sample of aluma transform block. For example, MTS is not applied to the residualsample of the luma transform block if cu_mts_flag=0 and MTS is appliedto the residual sample of the luma transform block if cu_mts_flag=1.

The decoding apparatus 200 can obtain mts_idx on the basis ofcu_mts_flag (S1015). For example, when cu_mts_flag=1, the decodingapparatus 200 can obtain mts_idx. Here, mts_idx indicates whichtransform kernel is applied to luma residual samples of a currenttransform block in the horizontal direction and/or the verticaldirection.

For example, at least one of embodiments described in the presentdescription can be applied to mts_idx.

The decoding apparatus 200 can derive a transform kernel correspondingto mts_idx (S1020). For example, the transform kernel corresponding tomts_idx can be separately defined as horizontal transform and verticaltransform.

For example, when MTS is applied to the current block (i.e.,cu_mts_flag=1), the decoding apparatus 200 can configure MTS candidateson the basis of the intra-prediction mode of the current block. In thiscase, the decoding flowchart of FIG. 10 may further include a step ofconfiguring MTS candidates. Then, the decoding apparatus 200 candetermine an MTS candidate to be applied to the current block from amongthe configured MTS candidates using mts_idx.

As another example, different transform kernels can be applied tohorizontal transform and vertical transform. However, the presentdisclosure is not limited thereto and the same transform kernel may beapplied to the horizontal transform and vertical transform.

The decoding apparatus 200 can perform inverse transform on the basis ofthe transform kernel (S1025).

Furthermore, in the specification, MTS may be represented as AMT or EMTand mts_idx may be represented as AMT_idx, EMT_idx, AMT_TU_idxEMT_TU_idx, or the like but the present disclosure is not limitedthereto.

The present disclosure is described by being divided into a case inwhich the MTS is applied and a case in which the MTS is not appliedbased on the MTS flag, but is not limited to such an expression. Forexample, whether or not the MTS is applied may be the same meaning aswhether to use other transform types (or transform kernels) other than apredefined specific transform type (which may be referred to as a basictransform type, a default transform type, etc.). If the MTS is applied,a transform type (e.g., any one transform type or a combined transformtype of two or more transform types among a plurality of transformtypes) other than a basic transform type may be used for a transform.Further, if the MTS is not applied, the basic transform type may be usedfor the transform. In an embodiment, the basic transform type may beconfigured (or defined) as DCT-2.

As an example, a MTS flag syntax indicating whether or not the MTS isapplied to a current transform block and when the MTS are applied, a MTSindex syntax indicating a transform type applied to the current blockmay also be individually transmitted from an encoder to a decoder. Asanother example, a syntax (e.g., MTS index) including both informationon whether or not the MTS is applied to a current transform block andwhen the MTS are applied, transform types applied to the current blockmay also be transmitted from an encoder to a decoder. That is, in thelatter example, a syntax (or syntax element) indicating a transform typeapplied to the current transform block (or unit) within all of transformtype groups (or transform type sets) including the above-described basictransform type may be transmitted from the encoder to the decoder.

Accordingly, despite the expressions, a syntax (MTS index) indicating atransform type applied to a current transform block may includeinformation on whether MTS is applied. In other words, in the latterembodiment, only an MTS index may be signaled without an MTS flag. Inthis case, DCT-2 may be interpreted as being included in MTS. However,in the present disclosure, a case where DCT-2 is applied may bedescribed as a case where MTS is not applied. Nevertheless, a technicalrange related to MTS is not limited to corresponding defined contents.

FIG. 11 is a block diagram of an apparatus that performs decoding on thebasis of MTS according to an embodiment of the present disclosure.

The decoding apparatus 200 to which the present disclosure is appliedmay include a sequence parameter acquisition unit 1105, an MTS flagacquisition unit 1110, an MTS index acquisition unit 1115, and atransform kernel derivation unit 1120.

The sequent parameter acquisition unit 1105 can acquiresps_mts_intra_enabled_flag or sps_mts_inter_enabled_flag. Here,sps_mts_intra_enabled_flag indicates whether cu_mts_flag is present in aresidual coding syntax of an intra-coding unit andsps_mts_inter_enabled_flag indicates whether cu_mts_flag is present in aresidual coding syntax of an inter-coding unit. Description withreference to FIG. 10 may be applied to a specific example.

The MTS flag acquisition unit 1110 can acquire cu_mts_flag on the basisof sps_mts_intra_enabled_flag or sps_mts_inter_enabled_flag. Forexample, the MTS flag acquisition unit 1110 can acquire cu_mts_flag whensps_mts_intra_enabled_flag=1 or sps_mts_inter_enabled_flag=1. Here,cu_mts_flag indicates whether MTS is applied to a residual sample of aluma transform block. Description with reference to FIG. 10 may beapplied to a specific example.

The MTS index acquisition unit 1115 can acquire mts_idx on the basis ofcu_mts_flag. For example, the MTS index acquisition unit 1115 canacquire mts_idx when cu_mts_flag=1. Here, mts_idx indicates whichtransform kernel is applied to luma residual samples of the currenttransform block in the horizontal direction and/or the verticaldirection. Description with reference to FIG. 10 may be applied to aspecific example.

The transform kernel derivation unit 1120 can derive a transform kernelcorresponding to mts_idx. Then, the decoding apparatus 200 can performinverse transform on the basis of the derived transform kernel.

A method of generating, by the decoding apparatus 200, a block includingresidual samples from a transform block through an inverse transform maybe as follows.

Input to this process is as follows:

-   -   luma position positions (xTbY, yTbY) indicating top left samples        of a current luma transform block for the top left luma sample        of a current picture,    -   a variable nTbW indicating the width of a current transform        block,    -   a variable nTbH indicating the height of the current transform        block,    -   a variable cldx indicating a chroma component of a current        block,    -   an (nTbW)×(nTbH) array d[x][y] of scaled transform coefficients        for x=0 . . . nTbW−1, y=0 . . . nTbH−1.

Output from this process is (nTbW)×(nTbH) array r[x][y] of residualsamples for x=0 . . . nTbW−1, y=0 . . . nTbH−1.

A variable trTypeHor indicating a horizontal transform kernel and avariable trTypeVer indicating a vertical transform kernel may be derivedbased on mts_idx[x][y] and CuPredMode[x][y] of Table 5.

The (nTbW)×(nTbH) array of the residual samples may be derived asfollows: −1. A (vertical) column of each scaled transform coefficientd[x][y] (x=0 . . . nTbW−1, y=0 . . . nTbH−1) is transformed into e[x][y](x=0 . . . nTbW−1, y=0 . . . nTbH−1) by a one-dimensional transformprocess for a column x=0 . . . nTbW−1. In this case, input is atransform type variable trType which is set identically with the heightnTbH of the transform block, the list d[x][y] (y=0 . . . nTbH−1), andtrTypeVer. The list e[x][y] (y=0 . . . nTbH−1) is output.

2. Intermediate sample values g[x][y] (x=0 . . . nTbW−1, y=0 . . .nTbH−1) are derived like Equation 4.

g[x][y] = Clip3(CoeffMin, CoeffMax, (e[x][y] + 256)  >>   9)

3. A (horizontal) row of each intermediate array g[x][y] (x=0 . . .nTbW−1, y=0 . . . nTbH−1) is transformed into r[x][y] (x=0 . . . nTbW−1,y=0 . . . nTbH−1) by a one-dimensional transform process for each rowy=0 . . . nTbH−1. In this case, input is a transform type variabletrType which is set identically with the width of the transform blocknTbW, the list g[x][y] (x=0 . . . nTbW−1), and trTypeVer. The listr[x][y] (y=0 . . . nTbH−1) is output.

TABLE 5 CuPredMode[x][y] = = CuPredMode[x][y] = = MODE _INTRA MODE_INTERmts_idx[x][y] trTypeHor trTypeVer trTypeHor trTypeVer −1 (inferred) 0 00 0 0 (00) 1 1 2 2 1 (01) 2 1 1 2 2 (10) 1 2 2 1 3 (11) 2 2 1 1

CuPredMode indicates a prediction mode applied to a current CU.

Mode-dependent non-separable secondary transform (MDNSST) is introduced.To maintain low complexity, MDNSST is applied to only low-frequencycoefficients after primary transform. Further, non-separable transformchiefly applied to low-frequency coefficients may be called lowfrequency non-separable transform (LFNST). If both the width (W) andheight (H) of a transform coefficient block are equal to or greater than8, 8×8 non-separable secondary transform is applied to an 8×8 top leftregion of the transform coefficient block. 4×4 non-separable secondarytransform is applied if the width or height is less than 8, and the 4×4non-separable secondary transform can be performed on top left min(8,W)×min(8, H) of the transform coefficient block. Here, min(A, B) is afunction of outputting a smaller value between A and B. Further, W×H isthe block size, W represents the width and H represents the height.

In an embodiment, a total of 35×3 non-separable secondary transforms maybe present fora 4×4 and/or 8×8 block size. In this case, 35 is thenumber of transform sets specified by an intra prediction mode. 3 is thenumber of NSST candidates for each prediction mode. Mapping from theintra prediction mode to the transform set may be variously defined.

In order to indicate a transform kernel among transform sets, an NSSTindex (NSST idx) can be coded. When NSST is not applied, NSST indexequal to 0 is signalled.

FIGS. 12 and 13 are flowcharts showing encoding/decoding to whichsecondary transform is applied as an embodiment to which presentdisclosure is applied.

In JEM, secondary transform (MDNSST) is not applied for a block codedwith transform skip mode. When the MDNSST index is signalled for a CUand not equal to zero, MDNSST is not used for a block of a componentthat is coded with transform skip mode in the CU. The overall codingstructure including coefficient coding and NSST index coding is shown inFIGS. 12 and 13. A CBF flag is encoded to determine whether coefficientcoding and NSST coding are performed. In FIGS. 12 and 13, the CBF flagcan represent a luma block cbg flag (cbf_luma flag) or a chroma blockcbf flag (cbf_cb flag or cbf_cr flag). When the CBF flag is 1, transformcoefficients are coded.

Referring to FIG. 12, the encoding apparatus 100 checks whether CBF is 1(S1205). If CBF is 0, the encoding apparatus 100 does not performtransform coefficient encoding and NSST index encoding. If CBF is 1, theencoding apparatus 100 performs encoding on transform coefficients(S1210). Thereafter, the encoding apparatus 100 determines whether toperform NSST index coding (S1215) and performs NSST index coding(S1220). When NSST index coding is not applied, the encoding apparatus100 can end the transform procedure without applying NSST and performthe subsequent step (e.g., quantization).

Referring to FIG. 13, the decoding apparatus 200 checks whether CBF is 1(S1305). If CBF is 0, the decoding apparatus 200 does not performtransform coefficient decoding and NSST index decoding. If CBF is 1, thedecoding apparatus 200 performs decoding on transform coefficients(S1310). Thereafter, the decoding apparatus 200 determines whether toperform NSST index coding (S1315) and parse an NSST index (S1320).

NSST can be applied to an 8×8 or 4×4 top left region instead of beingapplied to the entire block (TU in the case of HEVC) to which primarytransform has been applied. For example, 8×8 NSST can be applied when ablock size is 8×8 or more (that is, both of the width and height of ablock is greater than or equal to 8) and 4×4 NSST can be applied when ablock size is less than 8×8 (that is, both of the width and height isless than 8). Further, when 8×8 NSST is applied (that is, when a blocksize is 8×8 or more), 4×4 NSST can be applied per 4×4 block (that is,top left 8×8 region is divided into 4×4 blocks and 4×4 NSST is appliedto each 4×4 block). Both 8×8 NSST and 4×4 NSST can be determinedaccording to the above-described transform set configuration, and 8×8NSST may have 64 pieces of input data and 64 pieces of output data and4×4 NSST may have 16 inputs and 16 outputs because they arenon-separable transforms.

FIGS. 14 and 15 show an embodiment to which the present disclosure isapplied, FIG. 14 is a diagram for describing Givens rotation and FIG. 15shows a configuration of one round in 4×4 NSST composed of Givensrotation layers and permutations.

Both 8×8 NSST and 4×4 NSST can be configured as hierarchicalcombinations of Givens rotations. A matrix corresponding to one Givensrotation is represented as Equation 1 and a matrix product isrepresented as FIG. 14.

$\begin{matrix}{R_{\theta} = \begin{bmatrix}{cos\theta} & {- {sin\theta}} \\{sin\theta} & {cos\theta}\end{bmatrix}} & \left\lbrack {{Equation}\mspace{14mu} 1} \right\rbrack\end{matrix}$

In FIG. 14, t_(m) and t_(n) output according to Givens rotation can becalculated as represented by Equation 2.

$\begin{matrix}{{t_{m} = {{x_{m}{cos\theta}} - {x_{n}{sin\theta}}}}{t_{n} = {{x_{m}{sin\theta}} + {x_{n}{cos\theta}}}}} & \left\lbrack {{Equation}\mspace{14mu} 2} \right\rbrack\end{matrix}$

Since Givens rotation rotates two pieces of data as shown in FIG. 14, 32or 8 Givens rotations are required to process 64 (in the case of 8×8NSST) or 16 (in the case of 4×4 NSST) pieces of data. Accordingly, agroup of 32 or 8 Givens rotations can form a Givens rotation layer. Asshown in FIG. 15, output data for one Givens rotation layer istransmitted as input data for the next Givens rotation layer throughpermutation (shuffling). A pattern permuted as shown in FIG. 15 isregularly defined, and in the case of 4×3 NSST, four Givens rotationlayers and corresponding permutations form one round. 4×4 NSST isperformed by two rounds and 8×8 NSST is performed by four rounds.Although different rounds use the same permutation pattern, appliedGivens rotation angles are different. Accordingly, angle data for allGivens rotations constituting each permutation needs to be stored.

As a final step, one more permutation is finally performed on dataoutput through Givens rotation layers, and information aboutcorresponding permutation is separately stored for each permutation.Corresponding permutation is performed at the end of forward NSST andcorresponding reverse permutation is initially applied in inverse NSST.

Reverse NSST reversely performs Givens rotation layers and permutationsapplied to forward NSST and performs rotation by taking a negative valuefor each Given rotation angle.

Reduced Secondary Transform (RST)

FIG. 16 shows operation of RST as an embodiment to which the presentdisclosure is applied.

When an orthogonal matrix representing a transform is N×N, a reducedtransform (RT) leaves only R of N transform basic vectors (R<N). Amatrix with respect to forward RT that generates transform coefficientscan be defined by Equation 3.

$\begin{matrix}{T_{R \times N} = \begin{bmatrix}t_{11} & t_{12} & t_{13} & \; & t_{1N} \\t_{21} & t_{22} & t_{23} & \cdots & t_{2N} \\\; & \vdots & \; & \ddots & \vdots \\t_{R1} & t_{R2} & t_{R3} & \cdots & t_{RN}\end{bmatrix}} & \left\lbrack {{Equation}\mspace{14mu} 3} \right\rbrack\end{matrix}$

Since a matrix with respect to reverse RT is a transpose matrix of aforward RT matrix, application of forward RT and reverse RT isschematized as shown in FIGS. 16A and 16B.

RT applied to an 8×8 top left block of a transform coefficient block towhich primary transform has been applied can be referred to as 8×8 RST.When R is set to 16 in Equation 3, forward 8×8 RST has a form of 16×64matrix and reverse 8×8 RST has a form of 64×16 matrix. In this case, anM×N matrix may consist of M rows and N columns. Further, the transformset configuration as shown in Table 5 can be applied to 8×8 RST. Thatis, 8×8 RST can be determined on the basis of transform sets accordingto intra-prediction modes as shown in Table 5. Since one transform setis composed of two or three transforms according to an intra-predictionmode, one of a maximum of four transforms including a case in whichsecondary transform is not applied can be selected (one transform cancorrespond to an anisotropic matrix). When indices 0, 1, 2 and 3 areassigned to the four transforms, a transform to be applied can bedesignated by signaling a syntax element corresponding to an NSST indexfor each transform coefficient block. For example, the index 9 canassigned to an anisotropic matrix, that is, a case in which secondarytransform is not applied. Consequently, 8×8 NSST can be designatedaccording to JEM NSST and 8×8 RST can be designated according to RSTconfiguration for an 8×8 top left block through the NSST index.

FIG. 17 is a diagram showing a process of performing reverse scanningfrom the sixty-fourth coefficient to the seventeenth coefficient inreverse scanning order as an embodiment to which the present disclosureis applied.

When 8×8 RST as represented by Equation 3 is applied, 16 valid transformcoefficients are generated and thus 64 pieces of input data constitutingan 8×8 region are reduced to 16 pieces of output data and only a quarterregion is filled with valid transform coefficients according to theviewpoint of two-dimensional region. Accordingly, the 16 pieces ofoutput data obtained by applying forward 8×8 RST fill a top left regionof FIG. 17.

In FIG. 17, a 4×4 top left region becomes a region of interest (ROI)filled with valid transform coefficients and the remaining region isvacant. The vacant region may be filled with 0 as a default value. Ifnon-zero valid transform coefficients are discovered in regions otherthan the ROI of FIG. 17, it is definite that 8×8 RST has not beenapplied and thus corresponding coding may be omitted for correspondingNSST index. On the other hand, if non-zero valid transform coefficientsare not discovered in regions other than the ROI of FIG. 17 (8×8 RST isapplied or regions other than the ROI are filled with 0), the NSST indexmay be coded because 8×8 RST might be applied. Such conditional NSSTindex coding requires checking presence or absence of a non-zerotransform coefficient and thus can be performed after the residualcoding process.

FIG. 18 is an exemplary flowchart showing encoding using a singletransform indicator as an embodiment to which the present disclosure isapplied.

In an embodiment of the present disclosure, the single transformindicator (STI) is introduced. A single transform can be applied whenthe STI is enabled (STI coding==1) instead of sequentially used twotransforms (primary transform and secondary transform). Here, the singletransform may be any type of transform. For example, the singletransform may be a separable transform or a non-separable transform. Thesingle transform may be a transform approximated from a non-separabletransform. A single transform index (ST_idx in FIG. 18) can be signaledwhen the STI has been enabled. Here, the single transform index canindicate a transform to be applied form among available transformcandidates.

Referring to FIG. 18, the encoding apparatus 100 determines whether CBFis 1 (S1805). When CBF is 1, the encoding apparatus 100 determineswhether STI coding is applied (S1810). When STI coding is applied, theencoding apparatus 100 encodes an STI index STI_idx (S1845) and performscoding on transform coefficient (S1850). When STI coding is not applied,the encoding apparatus 100 encodes a flag EMT_CU_Flag indicating whetherEMT (or MTS) is applied at a CU level (S1815). Thereafter, the encodingapparatus 100 performs coding on the transform coefficients (S1820).Then, the encoding apparatus 100 determines whether EMT is applied to atransform unit (TU) (S1825). When EMT is applied to the TU, the encodingapparatus 100 encodes a primary transform index EMT_TU ldx applied tothe TU (S1830). Subsequently, the encoding apparatus 100 determineswhether NSST is applied (S1835). When NSST is applied, the encodingapparatus 100 encodes an index NSST_Idx indicating NSST to be applied(S1840).

In an example, if single transform coding conditions aresatisfied/enabled (e.g., STI_coding==1), the single transform indexST_Idx may be implicitly derived instead of being signaled. ST_idx canbe implicitly determined on the basis of a block size and anintra-prediction mode. Here, ST_Idx can indicate a transform (ortransform kernel) applied to the current transform block.

The STI can be enabled if one or more of the following conditions aresatisfied (STI_coding==1).

1) The block size corresponds to a predetermined value such as 4 or 8.

2) Block width==Block height (square block)

3) The intra-prediction mode is one of predetermined modes such as DCand planar modes.

In another example, the STI coding flag can be signaled in order toindicate whether the single transform is applied. The STI coding flagcan be signaled on the basis of an STI coding value and CBF. Forexample, the STI coding flag can be signaled when CBF is 1 and STIcoding is enabled. Furthermore, the STI coding flag can be conditionallysignaled in consideration of a block size, a block shape (square blockor non-square block) or an intra-prediction mode.

To use information acquired during coefficient coding, ST_idx may bedetermined after coefficient coding. In an example, ST_idx can beimplicitly determined on the basis of a block size, an intra-predictionmode and the number of non-zero coefficients. In another example, ST_idxcan be conditionally encoded/decoded on the basis of a block size, ablock shape, an intra-prediction mode and/or the number of non-zerocoefficients. In another example, ST_idx signaling may be omitteddepending on a distribution of non-zero coefficients (i.e., positions ofnon-zero coefficients). Particularly, when non-zero coefficients arediscovered in a region other than a 4×4 top left region, ST_idxsignaling can be omitted.

FIG. 19 is an exemplary flowchart showing encoding using a unifiedtransform indicator (UTI) as an embodiment to which the presentdisclosure is applied.

In an embodiment of the present disclosure, the unified transformindicator is introduced. The UTI includes a primary transform indicatorand a secondary transform indicator.

Referring to FIG. 19, the encoding apparatus 100 determines whether CBFis 1 (S1905). When CBF is 1, the encoding apparatus 100 determineswhether UTI coding is applied (S1910). When UTI coding is applied, theencoding apparatus 100 encodes a UTI index UTI_idx (S1945) and performscoding on transform coefficient (S1950). When UTI coding is not applied,the encoding apparatus 100 encodes the flag EMT_CU_Flag indicatingwhether EMT (or MTS) is applied at the CU level (S1915). Thereafter, theencoding apparatus 100 performs coding on the transform coefficients(S1920). Then, the encoding apparatus 100 determines whether EMT isapplied to a transform unit (TU) (S1925). When EMT is applied to the TU,the encoding apparatus 100 encodes a primary transform index EMT_TU ldxapplied to the TU (S1930). Subsequently, the encoding apparatus 100determines whether NSST is applied (S1935). When NSST is applied, theencoding apparatus 100 encodes an index NSST_Idx indicating NSST to beapplied (S1940).

The UTI may be coded for each predetermined unit (CTU or CU).

The UTI coding mode may be dependent on the following conditions.

1) Block size

2) Block shape

3) Intra-prediction mode

How to derive/extract a core transform index from the UTI is defined inadvance. How to derive/extract a secondary transform index from the UTIis defined in advance.

A syntax structure for the UTI can be optionally used. The UTI candepend on a CU (TU) size. For example, a smaller CU (TU) may have a UTIindex in a narrower range. In an example, the UTI can indicate only thecore transform index if a predefined condition (e.g., a block size isless than a predefined threshold value) is satisfied.

TABLE 6 Binalization Core Secondary UTI-Index (FLC) Transform IdxTransform Idx 0 00000 0 0 1 00001 0 1 2 00010 0 2 3 00011 0 3 4 00100 10 5 00101 1 1 6 00110 1 2 7 00111 1 3 . . . . . . . . . . . . 31 11111 53

In another example, UTI index may be considered as the core transformindex when secondary transform is not indicated to be used (e.g.,secondary transform index==0 or secondary transform is alreadypredetermined). In the same manner, UTI index may be considered as asecondary transform index when the core transform index is considered tobe known. Specifically, considering the intra prediction mode and theblock size, a predetermined core transform may be used.

FIGS. 20A and 20B illustrate two exemplary flowcharts showing encodingusing the UTI as an embodiment to which the present disclosure isapplied.

In another example, the transform coding structure may use UTI indexcoding as shown in FIGS. 20A and 20B. Here, the UTI index may be codedearlier than coefficient coding or later than coefficient coding.

Referring to the left flowchart of FIG. 20A, the encoding apparatus 100checks whether CBF is 1 (S2005). When CBF is 1, the encoding apparatus100 codes the UTI index UTI_idx (S2010) and performs coding on transformcoefficients (S2015).

Referring to the right flowchart of FIG. 20B, the encoding apparatus 100checks whether CBF is 1 (S2055). When CBF is 1, the encoding apparatus100 performs coding on the transform coefficients (S2060) and codes theUTI index UTI_idx (S2065).

In another embodiment of the present disclosure, data hiding andimplicit coding methods for transform indicators are introduced. Here,transform indicators may include ST_idx, UTI_idx, EMT_CU_Flag,EMT_TU_Flag, NSST_Idx and any sort of transform related index which maybe used to indicate a transform kernel. The above-mentioned transformindicator may not be signaled but the corresponding information may beinserted in a coefficient coding process (it can be extracted during acoefficient coding process). The coefficient coding process may includethe following parts.

-   -   Last_position_x, Last_position_y    -   Group flag    -   Significance map    -   Greather_than_l flag    -   Greather_than_2 flag    -   Remaining level coding    -   Sign coding

For example, transform indicator information may be inserted in one ormore of above-mentioned coefficient coding processes. In order to inserttransform indicator information, the followings may be consideredjointly.

Pattern of sign coding

The absolute value of remaining level

The number of Greather_than_1 flag

The values of Last_position_X and Last_position_Y

The above-mentioned data hiding method may be considered conditionally.For example, the data hiding method may be dependent on the number ofnon-zero coefficients.

In another example, NSST_idx and EMT_idx may be dependent. For example,NSST_idx may not be zero when EMT_CU_Flag is equal to zero (or one). Inthis case, NSST_idx−1 may be signaled instead of NSST_idx.

In another embodiment of the present disclosure, NSST transform setmapping based on intra-prediction mode is introduced as shown in thefollowing table 7. Although NSST is described below as an example ofnon-separable transform, another known terminology (e.g., LFNST) may beused for non-separable transform. For example, NSST set and NSST indexmay be replaced with LFNST set and LFNST index. Further, RST describedin this specification may also be replaced with LFNST as an example ofnon-separable transform (e.g., LFNST) using a non-square transformmatrix having a reduced input length and/or a reduced output length in asquare non-separable transform matrix applied to an at least a region(4×4 or 8×8 top left region or a region other than a 4×4 right bottomregion in an 8×8 block) of a transform block.

TABLE 7 intra mode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 NSST 0 0 2 22 2 2 2 2 2 2 2 2 18 18 18 16 Set intra mode 17 18 19 20 21 22 23 24 2526 27 28 29 30 31 32 33 NSST 18 18 18 18 18 18 18 34 34 34 34 34 34 3434 34 34 Set intra mode 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 4950 NSST 34 34 34 34 34 34 34 34 34 34 34 18 18 18 18 18 18 Set intramode 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 NSST 18 18 18 18 182 2 2 2 2 2 2 2 2 2 2 Set

The NSST Set number may be rearranged from 0 to 3 as shown in Table 8.

TABLE 8 intra mode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 NSST 0 0 1 11 1 1 1 1 1 1 1 1 2 2 2 2 Set intra mode 17 18 19 20 21 22 23 24 25 2627 28 29 30 31 32 33 NSST 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 Set intramode 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 NSST 3 3 3 3 3 33 3 3 3 3 2 2 2 2 2 2 Set intra mode 51 52 53 54 55 56 57 58 59 60 61 6263 64 65 66 NSST 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 Set

In the NSST transform set, only four transform sets (instead of 35) areused so that the required memory space can be reduced.

In addition, various numbers of transform kernels per transform set maybe used as follows.

Case A: Two available transform kernels for each transform set are usedso that the NSST index range is from 0 to 2. For example, when the NSSTindex is 0, secondary transform (inverse secondary transform based on adecoder) may not be applied. When the NSST index is 1 or 2, secondarytransform may be applied. The transform set may include two transformkernels to which an index 1 or 2 may be mapped.

TABLE 9 NSST Set 0 (DC, Planar) 1 2 3 # of transform kernels 2 2 2 2

Referring to Table 9, two transform kernels are used for each ofnon-separable transform (NSST or LFNST) sets 0 to 3.

Case B: Two available transform kernels are used for transform set 0 andone is used for others. Available NSST indices for transform set 0 (DCand Planar) are 0 to 2. However, NSST indices for other modes (transformsets 1, 2 and 3) are 0 to 1.

TABLE 10 NSST Set 0 (DC, Planar) 1 2 3 # of transform kernels 2 1 1 1

Referring to Table 10, two non-separable transform kernels are set for anon-separable transform (NSST) set corresponding to index 0 and onenon-separable transform kernel is set for each of non-separabletransform (NSST) sets corresponding to indices 1, 2 and 3.

Case C: One transform kernel is used per transform kernel and the NSSTindex range is 0 to 1.

TABLE 11 NSST Set 0 (DC, Planar) 1 2 3 # of transform kernels 1 1 1 1

FIG. 21 is an exemplary flowchart showing encoding for performingtransform as an embodiment to which the present disclosure is applied.

The encoding apparatus 100 performs primary transform on a residualblock (S2105). The primary transform may be referred to as coretransform. As an embodiment, the encoding apparatus 100 may perform theprimary transform using the above-mentioned MTS. Further, the encodingapparatus 100 may transmit an MTS index indicating a specific MTS fromamong MTS candidates to the decoding apparatus 200. Here, the MTScandidates may be configured on the basis of the intra-prediction modeof the current block.

The encoding apparatus 100 determines whether to apply secondarytransform (S2110). For example, the encoding apparatus 100 may determinewhether to apply the secondary transform on the basis of transformcoefficients of the primarily transformed residual block. For example,the secondary transform may be NSST or RST.

The encoding apparatus 100 determines the secondary transform (S2115).Here, the encoding apparatus 100 may determine the secondary transformon the basis of an NSST (or RST) transform set designated according tothe intra-prediction mode.

For example, the encoding apparatus 100 may determine a region to whichthe secondary transform will be applied on the basis of the size of thecurrent block prior to step S2115.

The encoding apparatus 100 performs the secondary transform determinedin step S2115 (S2120).

FIG. 22 is an exemplary flowchart showing decoding for performingtransform as an embodiment to which the present disclosure is applied.

The decoding apparatus 200 determines whether to apply inverse secondarytransform (S2205). For example, the inverse secondary transform may beNSST or RST. For example, the decoding apparatus 200 may determinewhether to apply the inverse secondary transform on the basis of asecondary transform flag received from the encoding apparatus 100.

The decoding apparatus 200 determines the inverse secondary transform(S2210). Here, the decoding apparatus 200 may determine the inversesecondary transform applied to the current block on the basis of theNSST (or RST) transform set designated according to the aforementionedintra-prediction mode.

Further, for example, the decoding apparatus 200 may determine a regionto which the inverse secondary transform will be applied on the basis ofthe size of the current block prior to step S2210.

The decoding apparatus 200 performs inverse secondary transform on aninversely quantized residual block using the inverse secondary transformdetermined in step S2210 (S2215).

The decoding apparatus performs inverse primary transform on theinversely secondarily transformed residual block (S2220). The inverseprimary transform may be called inverse core transform. In anembodiment, the decoding apparatus 200 may perform the inverse primarytransform using the aforementioned MTS. Further, as an example, thedecoding apparatus 200 may determine whether MTS is applied to thecurrent block prior to step S2220. In this case, the decoding flowchartof FIG. 22 may further include a step of determining whether MTS isapplied.

For example, when MTS is applied to the current block (i.e.,cu_mts_flag=1), the decoding apparatus 200 may configure MTS candidateson the basis of the intra-prediction mode of the current block. In thiscase, the decoding flowchart of FIG. 22 may further include a step ofconfiguring MTS candidates. In addition, the decoding apparatus 200 maydetermine inverse primary transform applied to the current block usingmtx_idx indicating a specific MTS from among the configured MTScandidates.

FIG. 23 is a detailed block diagram of the transform unit 120 in theencoding apparatus 100 as an embodiment to which the present disclosureis applied.

The encoding apparatus 100 to which an embodiment of the presentdisclosure is applied may include a primary transform unit 2310, asecondary transform application determination unit 2320, a secondarytransform determination unit 2330, and a secondary transform unit 2340.

The primary transform unit 2310 can perform primary transform on aresidual block. The primary transform may be referred to as coretransform. As an embodiment, the primary transform unit 2310 may performthe primary transform using the above-mentioned MTS. Further, theprimary transform unit 2310 may transmit an MTS index indicating aspecific MTS from among MTS candidates to the decoding apparatus 200.Here, the MTS candidates may be configured on the basis of theintra-prediction mode of the current block.

The secondary transform application determination unit 2320 candetermine whether to apply secondary transform. For example, thesecondary transform application determination unit 2320 may determinewhether to apply the secondary transform on the basis of transformcoefficients of the primarily transformed residual block. For example,the secondary transform may be NSST or RST.

The secondary transform determination unit 2330 determines the secondarytransform. Here, the secondary transform determination unit 2330 maydetermine the secondary transform on the basis of an NSST (or RST)transform set designated according to the intra-prediction mode asdescribed above.

For example, the secondary transform determination unit 2330 maydetermine a region to which the secondary transform will be applied onthe basis of the size of the current block.

The secondary transform unit 2340 can perform the determined secondarytransform.

FIG. 24 is a detailed block diagram of the inverse transform unit 230 inthe decoding apparatus 200 as an embodiment to which the presentdisclosure is applied.

The decoding apparatus 200 to which the present disclosure is appliedincludes an inverse secondary transform application determination unit2410, an inverse secondary transform determination unit 2420, an inversesecondary transform unit 2430, and an inverse primary transform unit2440.

The inverse secondary transform application determination unit 2410 candetermine whether to apply inverse secondary transform. For example, theinverse secondary transform may be NSST or RST. For example, the inversesecondary transform application determination unit 2410 may determinewhether to apply the inverse secondary transform on the basis of asecondary transform flag received from the encoding apparatus 100.

The inverse secondary transform determination unit 2420 can determinethe inverse secondary transform. Here, the inverse secondary transformdetermination unit 2420 may determine the inverse secondary transformapplied to the current block on the basis of the NSST (or RST) transformset designated according to the intra-prediction mode.

Further, for example, the inverse secondary transform determination unit2420 may determine a region to which the inverse secondary transformwill be applied on the basis of the size of the current block.

The inverse secondary transform unit 2430 can perform inverse secondarytransform on an inversely quantized residual block using the determinedinverse secondary transform.

The inverse primary transform unit 2440 can perform inverse primarytransform on the inversely secondarily transformed residual block. In anembodiment, the inverse primary transform unit 2440 may perform theinverse primary transform using the aforementioned MTS. Further, as anexample, the inverse primary transform unit 2440 may determine whetherMTS is applied to the current block.

For example, when MTS is applied to the current block (i.e.,cu_mts_flag=1), the inverse primary transform unit 2440 may configureMTS candidates on the basis of the intra-prediction mode of the currentblock. In addition, the inverse primary transform unit 2440 maydetermine inverse primary transform applied to the current block usingmtx_idx indicating a specific MTS from among the configured MTScandidates.

FIG. 25 is a flowchart for processing a video signal as an embodiment towhich the present disclosure is applied. The process of the flowchart ofFIG. 25 can be executed by the decoding apparatus 200 or the inversetransform unit 230.

First, the decoding apparatus 200 can determine whether reversenon-separable transform is applied to the current block on the basis ofa non-separable transform index and the width and height of the currentblock. For example, if the non-separable transform index is not 0 andthe width and height of the current block are equal to or greater than4, the decoding apparatus 200 can determine that the non-separabletransform is applied. If the non-separable transform index is 0 or thewidth or the height of the current block is less than 4, the decodingapparatus 200 can omit he reverse non-separable transform and performinverse primary transform.

In step S2505, the decoding apparatus 200 determines a non-separabletransform set index indicating a non-separable transform set used fornon-separable transform of the current block from among non-separabletransform sets predefined on the basis of the intra-prediction mode ofthe current block. A non-separable transform set index can be set suchthat it is allocated to each of four transform sets configured accordingto the range of the intra-prediction mode, as shown in Table 7 or Table8. That is, the non-separable transform set index can be determined as afirst index value when the intra-prediction mode is 0 and 1, determinedas a second index value when the intra-prediction mode is 2 to 12 or 56to 66, determined as a third index value when the intra-prediction modeis 13 to 23 or 45 to 55, and determined as a fourth index value when theintra-prediction mode is 24 to 44, as shown in Table 7 or Table 8.

Here, each of the predefined non-separable transform sets may includetwo transform kernels, as shown in Table 9. Further, each of thepredefined non-separable transform sets may include one or two transformkernels, as shown in Table 10 or 11.

In step S2510, the decoding apparatus 200 determines, as a non-separabletransform matrix, a transform kernel indicated by the non-separabletransform index for the current block from among transform kernelsincluded in the non-separable transform set indicated by thenon-separable transform set index. For example, two non-separabletransform kernels may be configured for each non-separable transform setindex value and the decoding apparatus 200 may determine a non-separabletransform matrix on the basis of the transform kernel indicated by thenon-separable transform index between two transform matrix kernelscorresponding to the non-separable transform set index.

In step S2515, the decoding apparatus 200 applies the non-separabletransform matrix to a top left region of the current block determined onthe basis of the width and height of the current block. For example,non-separable transform may be applied to an 8×8 top left region of thecurrent block if both the width and height of the current block areequal to or greater than 8 and non-separable transform may be applied toa 4×4 top left region of the current block if the width or height of thecurrent block is less than 8. The size of non-separable transform mayalso be set to a size (e.g. 48×16, 16×16) corresponding to 8×8 or 4×4 inresponse to a region to which non-separable transform will be applied.

Furthermore, the decoding apparatus 200 may apply horizontal transformand vertical transform to the current block to which non-separabletransform has been applied. Here, the horizontal transform and verticaltransform may be determined on the basis of an MTS index for selectionof the prediction mode and transform matrix applied to the currentblock.

Hereinafter, a method of applying a primary transform and a secondarytransform in a combined manner is described. That is, an embodiment ofthe present disclosure proposes a method of efficiently designing atransform used in the primary transform and the secondary transform. Inthis instance, the methods illustrated in FIGS. 1 to 25 can be applied,and the redundant description is omitted.

As described above, the primary transform represents a transform that isfirst applied to a residual block in an encoder. If the secondarytransform is applied, the encoder may perform the secondary transform onthe primary transformed residual block. If the secondary transform wasapplied, a secondary inverse transform may be performed before a primaryinverse transform in a decoder. The decoder may perform the primaryinverse transform on a secondary inverse transformed transformcoefficient block to derive a residual block.

In addition, as described above, a non-separable transform may be usedas the secondary transform, and the secondary transform may be appliedonly to coefficients of a low frequency of a top-left specific region inorder to maintain low complexity. The secondary transform applied tothese coefficients of the low frequency may be referred to as anon-separable secondary transform (NSST), a low frequency non-separabletransform (LFNST), or a reduced secondary transform (RST). The primarytransform may be referred to as a core transform.

In an embodiment of the present disclosure, a primary transformcandidate used in the primary transform and a secondary transform kernelused in the secondary transform may be predefined as variouscombinations. In the present disclosure, the primary transform candidateused in the primary transform may be referred to as a MTS candidate, butis not limited to the name. For example, the primary transform candidatemay be a combination of transform kernels (or transform types)respectively applied to horizontal and vertical directions, and thetransform kernel may be one of DCT-2, DST-7 and/or DCT8. In other words,the primary transform candidate may be at least one combination ofDCT-2, DST-7 and/or DCT-8. The following description is given withdetailed examples.

Combination A

In a combination A, as illustrated in the following Table 12, a primarytransform candidate and a secondary transform kernel may be definedaccording to an intra prediction mode.

TABLE 12 Primary transform Secondary transform Case 1 2 MTS candidatesfor 2 transform kernels for angular mode angular mode 4 MTS candidatesfor 2 transform kernels for non-angular non-angular mode Case 2 2 MTScandidates for 1 transform kernels for angular mode angular mode 4 MTScandidates for 2 transform kernels for non-angular non-angular mode Case3 2 MTS candidates for 1 transform kernels for angular mode angular mode4 MTS candidates for 1 transform kernels for non-angular non-angularmode

Referring to the above Table 12, as an example (Case 1), two primarytransform candidates may be used if the intra prediction mode hasdirectionality, and four primary transform candidates may be used if theintra prediction mode has no directionality (e.g., DC mode, planarmode). In this instance, a secondary transform candidate may include twotransform kernels irrespective of the directionality of the intraprediction mode. That is, as described above, a plurality of secondarytransform kernel sets may be predefined according to the intraprediction mode, and each of the plurality of predefined secondarytransform kernel sets may include two transform kernels.

Further, as an example (Case 2), two primary transform candidates may beused if the intra prediction mode has directionality, and four primarytransform candidates may be used if the intra prediction mode has nodirectionality. In this instance, a secondary transform candidate mayinclude one transform kernel if the intra prediction mode hasdirectionality, and a secondary transform candidate may include twotransform kernels if the intra prediction mode has no directionality.

Further, as an example (Case 3), two primary transform candidates may beused if the intra prediction mode has directionality, and four primarytransform candidates may be used if the intra prediction mode has nodirectionality. In this instance, a secondary transform candidate mayinclude one transform kernel irrespective of the directionality of theintra prediction mode.

Combination B

In a combination B, as illustrated in the following Table 13, a primarytransform candidate and a secondary transform kernel may be definedaccording to an intra prediction mode.

TABLE 13 Primary transform Secondary transform Case 1 3 MTS candidatesfor 2 transform kernels for angular mode angular mode 3 MTS candidatesfor 2 transform kernels for non-angular non-angular mode Case 2 3 MTScandidates for 1 transform kernels for angular mode angular mode 3 MTScandidates for 2 transform kernels for non-angular non-angular mode Case3 3 MTS candidates for 1 transform kernels for angular mode angular mode3 MTS candidates for 1 transform kernels for non-angular non-angularmode

Referring to the above Table 13, as an example (Case 1), three primarytransform candidates may be used irrespective of the directionality ofthe intra prediction mode. In this instance, a secondary transformcandidate may include two transform kernels irrespective of thedirectionality of the intra prediction mode. That is, as describedabove, a plurality of secondary transform kernel sets may be predefinedaccording to the intra prediction mode, and each of the plurality ofpredefined secondary transform kernel sets may include two transformkernels.

Further, as an example (Case 2), three primary transform candidates maybe used irrespective of the directionality of the intra prediction mode.In this instance, a secondary transform candidate may include onetransform kernel if the intra prediction mode has directionality, andthe secondary transform candidate may include two transform kernels ifthe intra prediction mode has no directionality.

Further, as an example (Case 3), three primary transform candidates maybe used irrespective of the directionality of the intra prediction mode.In this instance, a secondary transform candidate may include onetransform kernel irrespective of the directionality of the intraprediction mode.

Combination C

In a combination C, as illustrated in the following Table 14, a primarytransform candidate and a secondary transform kernel may be definedaccording to an intra prediction mode.

TABLE 14 Primary transform Secondary Transform Case 1 2 MTS candidatesfor 2 transform kernels for angular mode angular mode 3 MTS candidatesfor 2 transform kernels for non-angular non-angular mode Case 2 2 MTScandidates for 1 transform kernels for angular mode angular mode 3 MTScandidates for 2 transform kernels for non-angular non-angular mode Case3 2 MTS candidates for 1 transform kernels for angular mode angular mode3 MTS candidates for 1 transform kernels for non-angular non-angularmode

Referring to the above Table 14, as an example (Case 1), two primarytransform candidates may be used if the intra prediction mode hasdirectionality, and three primary transform candidates may be used ifthe intra prediction mode has no directionality (e.g., DC mode, planarmode). In this instance, a secondary transform candidate may include twotransform kernels irrespective of the directionality of the intraprediction mode. That is, as described above, a plurality of secondarytransform kernel sets may be predefined according to the intraprediction mode, and each of the plurality of predefined secondarytransform kernel sets may include two transform kernels.

Further, as an example (Case 2), two primary transform candidates may beused if the intra prediction mode has directionality, and three primarytransform candidates may be used if the intra prediction mode has nodirectionality. In this instance, a secondary transform candidate mayinclude one transform kernel if the intra prediction mode hasdirectionality, and the secondary transform candidate may include twotransform kernels if the intra prediction mode has no directionality.

Further, as an example (Case 3), two primary transform candidates may beused if the intra prediction mode has directionality, and three primarytransform candidates may be used if the intra prediction mode has nodirectionality. In this instance, a secondary transform candidate mayinclude one transform kernel irrespective of the directionality of theintra prediction mode.

The above description was given focusing on the case of using theplurality of primary transform candidates. The following describescombinations of a primary transform and a secondary transform in case ofusing a fixed primary transform candidate, by way of example.

Combination D

In a combination D, as illustrated in the following Table 15, a primarytransform candidate and a secondary transform kernel may be definedaccording to an intra prediction mode.

TABLE 15 Primary transform Secondary Transform Case 1 1 fixed MTScandidate 2 transform kernels for angular mode for all modes 2 transformkernels for non-angular mode Case 2 1 fixed MTS candidate 1 transformkernels for angular mode for all modes 2 transform kernels fornon-angular mode Case 3 1 fixed MTS candidate 1 transform kernels forangular mode for all modes 1 transform kernels for non-angular mode

Referring to the above Table 15, as an embodiment, one primary transformcandidate may be fixedly used irrespective of the intra prediction mode.For example, the fixed primary transform candidate may be at least onecombination of DCT-2, DST-7 and/or DCT-8.

As an example (Case 1), one primary transform candidate may be fixedlyused irrespective of the intra prediction mode. In this instance, asecondary transform candidate may include two transform kernelsirrespective of the directionality of the intra prediction mode. Thatis, as described above, a plurality of secondary transform kernel setsmay be predefined according to the intra prediction mode, and each ofthe plurality of predefined secondary transform kernel sets may includetwo transform kernels.

Further, as an example (Case 2), one primary transform candidate may befixedly used irrespective of the intra prediction mode. In thisinstance, a secondary transform candidate may include one transformkernel if the intra prediction mode has directionality, and thesecondary transform candidate may include two transform kernels if theintra prediction mode has no directionality.

Further, as an example (Case 3), one primary transform candidate may befixedly used irrespective of the intra prediction mode. In thisinstance, a secondary transform candidate may include one transformkernel irrespective of the directionality of the intra prediction mode.

Combination E

In a combination E, as illustrated in the following Table 16, a primarytransform candidate and a secondary transform kernel may be definedaccording to an intra prediction mode.

TABLE 16 Primary transform (DCT2 applied) Secondary Transform Case 1DCT2 is applied 2 transform kernels for angular mode 2 transform kernelsfor non-angular mode Case 2 DCT2 is applied 1 transform kernels forangular mode 2 transform kernels for non-angular mode Case 3 DCT2 isapplied 1 transform kernels for angular mode 1 transform kernels fornon-angular mode

Referring to the above Table 16, as long as DCT-2 is applied as theprimary transform, a secondary transform may be defined. In other words,if MTS is not applied (i.e., if the DCT-2 is applied as the primarytransform), a secondary transform can be applied. As illustrated in FIG.10 above, the present disclosure is described by being divided into acase in which the MTS is applied and a case in which the MTS is notapplied, but is not limited to such an expression. For example, whetheror not the MTS is applied may be the same meaning as whether to use atransform type (or transform kernel) other than a predefined specifictransform type (which may be referred to as a basic transform type, adefault transform type, etc.). If the MTS is applied, a transform type(e.g., any one transform type or a combined transform type of two ormore transform types among a plurality of transform types) other thanthe basic transform type may be used for transform. Further, if the MTSis not applied, the basic transform type may be used for the transform.In an embodiment, the basic transform type may be configured (ordefined) as DCT-2.

As an example (Case 1), when the DCT-2 is applied to a primarytransform, a secondary transform can be applied. In this instance, asecondary transform candidate may include two transform kernelsirrespective of the directionality of the intra prediction mode. Thatis, as described above, a plurality of secondary transform kernel setsmay be predefined according to the intra prediction mode, and each ofthe plurality of predefined secondary transform kernel sets may includetwo transform kernels.

Further, as an example (Case 2), when the DCT-2 is applied to a primarytransform, a secondary transform can be applied. In this instance, asecondary transform candidate may include one transform kernel if theintra prediction mode has directionality, and the secondary transformcandidate may include two transform kernels if the intra prediction modehas no directionality.

Further, as an example (Case 3), when the DCT2 is applied to a primarytransform, a secondary transform can be applied. In this instance, asecondary transform candidate may include one transform kernelirrespective of the directionality of the intra prediction mode.

FIG. 26 is a flow chart illustrating a method for transforming a videosignal according to an embodiment to which the present disclosure isapplied.

Referring to FIG. 26, the present disclosure is described based on adecoder for the convenience of the explanation, but is not limitedthereto. A transform method for a video signal according to anembodiment of the disclosure can be substantially equally applied toeven an encoder. The flow chart illustrated in FIG. 26 may be performedby the decoding device 200 or the inverse transform unit 230.

The decoding device 200 parses a first syntax element indicating aprimary transform kernel applied to the primary transform of a currentblock in S2601.

The decoding device 200 determines whether a secondary transform isapplicable to the current block based on the first syntax element inS2602.

If the secondary transform is applicable to the current block, thedecoding device 200 parses a second syntax element indicating asecondary transform kernel applied to the secondary transform of thecurrent block in S2603.

The decoding device 200 derives a secondary inverse-transformed block,by performing a secondary inverse-transform for a top-left specificregion of the current block using the secondary transform kernelindicated by the second syntax element in S2604.

The decoding device 200 derives a residual block of the current block,by performing a primary inverse-transform for the secondaryinverse-transformed block using the primary transform kernel indicatedby the first syntax element in S2605.

As described above, the step S2602 may be performed by determining thatthe secondary transform is applicable to the current block if the firstsyntax element indicates a predefined first transform kernel. In thisinstance, the first transform kernel may be defined as DCT-2.

Further, as described above, the decoding device 200 may determine asecondary transform kernel set used for a secondary transform of thecurrent block among predefined secondary transform kernel sets based onan intra prediction mode of the current block. The second syntax elementmay indicate a secondary transform kernel applied to the secondarytransform of the current block in the determined secondary transformkernel set.

Further, as described above, each of the predefined secondary transformkernel sets may include two transform kernels.

In an embodiment of the present disclosure, an example of a syntaxstructure in which a multiple transform set (MTS) is used will bedescribed.

For example, the following table 17 shows an example of a syntaxstructure of a sequence parameter set.

TABLE 17 seq_parameter_set_rbsp( ) { Descriptor sps_seq_parameter_set_id ue(v)  chroma_format_idc ue(v) if(chroma_format_idc = = 3)   separate_colour_plane_flag u(1) pic_width_in_luma_samples ue(v)  pic_height_in_luma_samples ue(v) bit_depth_luma_minus8 ue(v)  bit_depth_chroma_minus8 ue(v) qtbtt_dual_tree_intra_flag ue(v)  log2_ctu_size_minus2 ue(v) log2_min_qt_size_intra_slices_minus2 ue(v) log2_min_qt_size_inter_slices_minus2 ue(v) max_mtt_hierarchy_depth_inter_slices ue(v) max_mtt_hierarchy_depth_intra_slices ue(v)  sps_cclm_enabled_flag ue(1) sps_mts_intra_enabled_flag ue(1)  sps_mts_inter_enabled_flag ue(1) rbsp_trailing_bits( ) }

Referring to Table 17, whether the MTS according to an embodiment of thepresent disclosure can be used may be signaled through a sequenceparameter set syntax. Here, sps_mts_intra_enabled_flag indicatespresence or absence of an MTS flag or an MTS index in a lower levelsyntax (e.g., a residual coding syntax or a transform unit syntax) withrespect to an intra-coding unit. In addition, sps_mts_inter_enabled_flagindicates presence or absence of an MTS flag or an MTS index in a lowerlevel syntax with respect to an inter-coding unit.

As another example, the following table 18 shows an example of atransform unit syntax structure.

TABLE 18     transform_unit(x0, y0, tbWidth, tbHeight, treeType) {Descriptor  if(treeType = = SINGLE_TREE ∥ treeType = = DUAL_TREE_LUMA)  tu_cbf_luma[x0][y0] ae(v)  if(treeType = = SINGLE_TREE ∥ treeType = =DUAL_TREE_CHROMA) {   tu_cbf_cb[x0][y0] ae(v)   tu_cbf_cr[x0][y0] ae(v) } if((((CuPredMode[x0][y0] = = MODE_INTRA) && sps_mts_intra_enabled_flag) ∥ ((CuPredMode[x0][y0] = = MODE_INTER) &&sps_mts_inter_enable d_flag))    && tu_cbf_luma[x0][y0] && treeType ! =DUAL_TREE_CHROMA    && (tbWidth <= 32) && (tbHeight <= 32) )  cu_mts_flag[x0][y0] ae(v)  if(tu_cbf_luma[x0][y0])  residual_coding(x0, y0, log2(tbWidth), log2(tbHeight), 0) if(tu_cbf_cb[x0][y0])   residual_coding(x0, y0, log2(tbWidth / 2),log2(tbHeight / 2), 1)  if(tu_cbf_cr[x0][y0])   residual_coding(x0, y0,log2(tbWidth / 2), log2(tbHeight / 2), 2) }

Referring to Table 18, cu_mts_flag indicates whether MTS is applied to aresidual sample of a luma transform block. For example, MTS is notapplied to the residual sample of the luma transform block ifcu_mts_flag=0, and MTS is applied to the residual sample of the lumatransform block if cu_mts_flag=1.

Although a case in which MTS is applied and a case in which MTS is notapplied based on the MTS flag are separately described in the presentdisclosure, as described above, the present disclosure is not limitedthereto. For example, whether MTS is applied may mean whether atransform type (or transform kernel) other than a predefined specifictransform type (which may be referred to as a basic transform type, adefault transform type, or the like) is used. A transform type (e.g.,any one of a plurality of transform types or a combination of two ormore thereof) other than the default transform type may be used for atransform if MTS is applied, and the default transform type may be usedif MTS is not applied. In an embodiment, the default transform type maybe set (or defined) as DCT-2.

For example, an MTS flag syntax indicating whether MTS is applied to acurrent transform block, and an MTS index syntax indicating a transformtype applied to the current block when MTS is applied can beindividually transmitted from an encoder to a decoder. As anotherexample, a syntax (e.g., MTS index) including both information onwhether MTS is applied to the current transform block and a transformtype applied to the current block when MTS is applied can be transmittedfrom the encoder to the decoder. That is, in the latter embodiment, asyntax (or syntax element) indicating a transform type applied to thecurrent transform block (or unit) in a transform type groups (ortransform type set) including the aforementioned default transform typecan be transmitted from the encoder to the decoder.

Accordingly, despite the expressions, a syntax (MTS index) indicating atransform type applied to a current transform block may includeinformation on whether MTS is applied. In other words, in the latterembodiment, only an MTS index may be signaled without an MTS flag. Inthis case, DCT-2 may be interpreted as being included in MTS. However,in the present disclosure, a case where DCT-2 is applied may bedescribed as a case where MTS is not applied. Nevertheless, a technicalrange related to MTS is not limited to corresponding defined contents.

As another example, the following table 19 shows an example of aresidual unit syntax structure.

TABLE 19  residual_coding(x0, y0, log2TbWidth, log2TbHeight, cIdx) {Descriptor  if(transform_skip_enabled_flag &&  (cIdx ! = 0 | |cu_mts_flag[x0][y0] = = 0) &&   (log2TbWidth <= 2) && (log2TbHeight <=2))   transform_skip_flag[x0][y0][cIdx] ae(v)  last_sig_coeff_x_prefixae(v)  last_sig_coeff_y_prefix ae(v)  if(last_sig_coeff_x_prefix > 3)  last_sig_coeff_x_suffix ae(v)  if(last_sig_coeff_y_prefix > 3)  last_sig_coeff_y_suffix ae(v)  log2SbSize = (Min(log2TbWidth,log2TbHeight) < 2 ? 1 :  2)  numSbCoeff = 1 << (log2SbSize << 1) lastScanPos = numSbCoeff  lastSubBlock = (1 <<  (log2TbWidth +log2TbHeight − 2 * log2SbSize)) − 1  do {   if(lastScanPos == 0) {   lastScanPos = numSbCoeff    lastSubBlock− −   }   lastScanPos− − xS =DiagScanOrder[log2TbWidth − log2SbSize][log2TbHeight − log2SbSiz e]     [lastSubBlock][0] yS = DiagScanOrder[log2TbWidth −log2SbSize][log2TbHeight − log2SbSiz e]     [lastSubBlock][1]   xC = (xS<< log2SbSize) +  DiagScanOrder[log2SbSize][log2SbSize][lastScanPos][0]  yC = (yS << log2SbSize) + DiagScanOrder[log2SbSize][log2SbSize][lastScanPos][1]   } while((xC !=LastSignificantCoeffX) | | (yC != LastSignificantCoeffY))  QState = 0 for(i = lastSubBlock, i >= 0; i− −) {   startQStateSb = QState   xS = DiagScanOrder[log2TbWidth − log2SbSize][log2TbHeight − log  2SbSize]      [lastSubBlock][0] yS = DiagScanOrder[log2TbWidth −log2SbSize][log2TbHeight − log2SbSiz e]      [lastSubBlock][1]  inferSbDcSigCoeff Flag = 0   if((i < lastSubBlock) && (i > 0)) {   coded_sub_block_flag[xS][yS] ae(v)    inferSbDcSigCoeff Flag = 1   }  firstSigScanPosSb = numSbCoeff   lastSigScanPosSb = −1   for(n = (i == lastSubBlock) ? lastScanPos − 1 :  numSbCoeff − 1; n >= 0; n− −) {   xC = (xS << log2SbSize) + DiagScanOrder[log2SbSize][log2SbSize][n][0]    yC = (yS <<log2SbSize) +  DiagScanOrder[log2SbSize][log2SbSize][n][1]   if(coded_sub_block_flag[xS][yS] && (n > 0 | | !inferSbDcSigCoeffFlag)) {     sig_coeff_flag[xC][yC] ae(v)    }   if(sig_coeff_flag[xC][yC]) {     par_level_flag[n] ae(v)    rem_abs_gtl_flag[n] ae(v)     if(lastSigScanPosSb = = −1)     lastSigScanPosSb = n     firstSigScanPosSb = n    }   AbsLevelPass1[xC][yC] =     sig_coeff_flag[xC][yC] +par_level_flag[n] + 2 *  rem_abs_gt1_flag[n]   if(dep_quant_enabled_flag)     QState =QStateTransTable[QState][par_level_flag[n]]   }   for(n = numSbCoeff −1; n >= 0; n− −) {    if(rem_abs_gt1_flag[n])     rem_abs_gt2_flag[n]ae(v)   }   for(n = numSbCoeff − 1; n >= 0; n− −) {    xC = (xS <<log2SbSize) +  DiagScanOrder[log2SbSize][log2SbSize][n][0]    yC = (yS<< log2SbSize) +  DiagScanOrder[log2SbSize][log2SbSize][n][1]   if(rem_abs_gt2_flag[n])     abs_remainder[n]    AbsLevel[xC][yC] =AbsLevelPass1[xC][yC] +         2 * (rem_abs_gt2_flag[n] +abs_remainder[n])   }   if(dep_quant_enabled_flag | | !sign_data_hiding_enabled_flag)    signHidden = 0   else    signHidden= (lastSigScanPosSb − firstSigScanPosSb > 3  ? 1 : 0)   for(n =numSbCoeff − 1; n >= 0; n− −) {    xC = (xS << log2SbSize) + DiagScanOrder[log2SbSize][log2SbSize][n][0]    yC = (yS <<log2SbSize) +  DiagScanOrder[log2SbSize][log2SbSize][n][1]   if(sig_coeff_flag[xC][yC] &&     (!signHidden | | (n !=firstSigScanPosSb)))     coeff_sign_flag[n] ae(v)   }  if(dep_quant_enabled_flag) {    QState = startQStateSb    for(n =numSbCoeff − 1; n >= 0; n− −) {     xC = (xS << log2SbSize) + DiagScanOrder[log2SbSize][log2SbSize][n][0]     yC = (yS <<log2SbSize) +  DiagScanOrder[log2SbSize][log2SbSize][n][1]    if(sig_coeff_flag[xC][yC])     TransCoeffLevel[x0][y0][cIdx][xC][yC] =       (2 * AbsLevel[xC][yC]− (QState > 1 ? 1 : 0))*       (1 − 2 * coeff_sign_flag[n])     QState =QStateTransTable[QState][par_level_flag[n]]   } else {    sumAbsLevel =0    for(n = numSbCoeff − 1; n >= 0; n− −) {     xC = (xS <<log2SbSize) +       DiagScanOrder[log2SbSize][log2SbSize][n][0]     yC =(yS << log2SbSize) +       DiagScanOrder[log2SbSize][log2SbSize][n][1]    if(sig_coeff_flag[xC][yC]) {     TransCoeffLevel[x0][y0][cIdx][xC][yC] =       AbsLevel[xC][yC] * (1− 2 * coeff_sign_flag[n])      if(signHidden) {       sumAbsLevel +=AbsLevel[xC][yC]       if((n = = firstSigScanPosSb) &&  (sumAbsLevel %2) = = 1))        TransCoeffLevel[x0][y0][cIdx][xC][yC]=         −TransCoeffLevel[x0][y0][cIdx][xC][yC]      }     }    }   }  }  if(cu_mts_flag[x0][y0] && (cIdx = = 0) &&  !transform_skip_flag[x0][y0][cIdx] &&   ((CuPredMode[x0][y0] = =MODE_INTRA && numSigCoeff  > 2) | |   (CuPredMode[x0][y0] = =MODE_INTER)) ) {   mts_idx[x0][y0] ae(v)  }

Referring to Table 19, transform_skip_flag and/or mts_idx syntax (orsyntax element) can be signaled through a residual syntax. However, thisis merely an example and the present disclosure is not limited thereto.For example, transform_skip_flag and/or mts_idx syntax may be signaledthrough a transform unit syntax.

Hereinafter, a method for improving complexity by applying primarytransform only to a predefined region is proposed. When combinations ofvarious transforms (or transform kernels) such as MTS (e.g., DCT-2,DST-7, DCT-8, DST-1, DCT-5, etc.) are selectively applied to primarytransform, complexity may increase. Particularly, various transformsneed to be considered as a coding block (or transform block) sizeincreases, which may considerably increase complexity.

Accordingly, in an embodiment of the present disclosure, a method forperforming a transform only on a predefined region according to specificconditions instead of performing the transform on (or applying to) allregions in order to reduce complexity is proposed.

As an embodiment, an encoder may obtain an R×R transform block insteadof an M×M transform block by applying forward primary transform to anM×M pixel block (luma block) based on the reduced transform (RT) methoddescribed above with respect to FIGS. 16 to 24. For example, an R×Rregion may be a top-left R×R region in a current block (coding block ortransform block). A decoder may obtain an M×M transform block byperforming inverse primary transform only on an R×R (ME R) region.

Consequently, non-zero coefficients may be present only in the R×Rregion. In this case, the decoder can zero-out coefficients present inregions other than the R×R region without performing calculationtherefor. The encoder can perform forward transform such that only theR×R region remains (such that non-zero coefficients are present only inthe R×R region).

Further, the decoder may apply primary transform (i.e., reversetransform) only to a predefined region determined according to the sizeof a coding block (or transform block) and/or transform (or transformkernel) type. The following table 20 shows Reduced Adaptive MultipleTransform (RAMT) using a predefined R value (which may be referred to asa reduced factor, a reduced transform factor, or the like) depending onthe size of a transform (or the size of a transform block). In thepresent disclosure, Reduced Adaptive Multiple Transform (RAMT)representing reduced transform adaptively determined depending on ablock size may be referred to as Reduced MTS (Multiple TransformSelection), Reduced explicit multiple transform, Reduced primarytransform, and the like.

TABLE 20 Transform Reduced Reduced Reduced size transform 1 transform 2transform 3 8 × 8 4 × 4 6 × 6 6 × 6 16 × 16 8 × 8 12 × 12 8 × 8 32 × 3216 × 16 16 × 16 16 × 16 64 × 64 32 × 32 16 × 16 16 × 16 128 × 128 32 ×32 16 × 16 16 × 16

Referring to Table 20, at least one reduced transform can be defineddepending on a transform size (or transform block size). In anembodiment, which reduced transform among reduced transforms shown inTable 20 will be used may be determined according to a transform (ortransform kernel) applied to a current block (coding block or transformblock). Although a case in which three reduced transforms are used isassumed in Table 20, the present disclosure is not limited thereto andone or more various reduced transforms may be predefined depending ontransform sizes.

Further, in an embodiment of the present disclosure, a reduced transformfactor (R) may be determined depending on primary transform inapplication of the aforementioned reduced adaptive multiple transform.For example, when the primary transform is DCT-2, coding performancedeterioration can be minimized by not using reduced transform for asmall block or by using a relatively large R value because computationalcomplexity of DCT-2 is lower than those of other primary transforms(e.g., a combination of DST-7 and/or DCT-8). The following table 21shows Reduced Adaptive Multiple Transform (RAMT) using a predefined Rvalue depending on a transform size (or transform block size) and atransform kernel.

TABLE 21 Transform Reduced transform Reduced transform size for DCT2except DCT2 8 × 8 8 × 8 4 × 4 16 × 16 16 × 16 8 × 8 32 × 32 32 × 32 16 ×16 64 × 64 32 × 32 32 × 32 128 × 128 32 × 32 32 × 32

Referring to Table 21, in a case in which a transform applied as primarytransform is DCT-2 and a case in which the transform applied as primarytransform is a transform except DCT-2 (e.g., a combination of DST7and/or DCT8), different reduced transform factors can be used.

FIG. 27 is a diagram illustrating a method for encoding a video signalusing reduced transform as an embodiment to which the present disclosureis applied.

Referring to FIG. 27, an encoder determines whether to apply a transformto a current block (S2701). The encoder may encode a transform skip flagaccording to a determination result. In this case, the step of encodingthe transform skip flag may be included in step S2701.

When the transform is applied to the current block, the encoderdetermines a transform kernel applied to primary transform of thecurrent block (S2702). The encoder may encode a transform indexindicating the determined transform kernel. In this case, the step ofencoding the transform index may be included in step S2702.

The encoder determines a region in which a significant coefficient ispresent within the current block based on the transform kernel appliedto the primary transform of the current block and the size of thecurrent block (S2703).

As an embodiment, the encoder may determine a region having a widthand/or a height corresponding to a predefined size as the region inwhich the significant coefficient is present when the transform kernelindicated by the transform index are a predefined transform and thewidth and/or the height of the current block are greater than thepredefined size.

For example, the predefined transform may be one of a plurality oftransform combinations of DST-7 and/or DCT-8, and the predefined sizemay be 16. Alternatively, the predefined transform may be a transformexcept DCT-2. As an example, the encoder may determine a region having awidth and/or a height of 32 as the region to which the primary transformis applied when the transform kernel indicated by the transform index isDCT-2 and the width and/or the height of the current block are greaterthan 32.

Further, as an embodiment, the encoder may determine a smaller valuebetween the width of the current block and a first threshold value asthe width of the region to which the primary transform is applied anddetermine a smaller value between the height of the current block andthe first threshold value as the height of the region in which thesignificant coefficient is present when the transform kernel indicatedby the transform index belongs to a first transform group. For example,the first threshold value may be 32, but the present disclosure is notlimited thereto and the first threshold value may be 4, 8, or 16 asshown in Table 20 or Table 21.

In addition, the encoder may determine a smaller value between the widthof the current block and a second threshold value as the width of theregion to which the primary transform is applied and determine a smallervalue between the height of the current block and the second thresholdvalue as the height of the region in which the significant coefficientis present when the transform kernel indicated by the transform indexbelongs to a second transform group. For example, the second thresholdvalue may be 16, but the present disclosure is not limited thereto andthe second threshold value may be 4, 6, 8, 12, or 32 as shown in Table20 or Table 21.

As an embodiment, the first transform group may include DCT2 and thesecond transform group may include a plurality of transform combinationsof DST7 and/or DCT8.

The encoder performs forward primary transform using the transformkernel applied to the primary transform of the current block (S2704).The encoder can obtain primarily transformed transform coefficients inthe region in which the significant coefficient is present by performingthe forward primary transform. As an embodiment, the encoder may applysecondary transform to the primarily transformed transform coefficients.In this case, the methods described above with reference to FIG. 6 toFIG. 26 can be applied.

FIG. 28 is a diagram illustrating a method for decoding a video signalusing reduced transform as an embodiment to which the present disclosureis applied.

A decoder checks whether transform skip is applied to a current block(S2801).

When transform skip is not applied to the current block, the decoderobtains a transform index indicating a transform kernel applied to thecurrent block from a video signal (S2802).

The decoder determines a region in which primary transform (i.e.,primary inverse transform) is applied to the current block based on thetransform kernel indicated by the transform index and the size (i.e.,the width and/or the height) of the current block (S2803).

As an embodiment, the decoder may set coefficients of the remainingregion except the region to which the primary transform is applied as 0.

In addition, as an embodiment, when the transform kernel indicated bythe transform index is a predefined transform and the width and/or theheight of the current block are greater than a predefined size, thedecoder may determine a region having a width and/or a heightcorresponding to the predefined size as the region to which the primarytransform is applied.

For example, the predefined transform may be any one of a plurality oftransform combinations of DST-7 and/or DCT-8, and the predefined sizemay be 16. Alternatively, the predefined transform may be a transformexcept DCT-2. For example, when the transform kernel indicated by thetransform index is DCT-2 and the width and/or the height of the currentblock are greater than 32, the decoder may determine a region having awidth and/or a height of 32 as the region to which the primary transformis applied.

Furthermore, as an embodiment, the decoder may determine a smaller valuebetween the width of the current block and a first threshold value asthe width of the region to which the primary transform is applied anddetermine a smaller value between the height of the current block andthe first threshold value as the height of the region to which theprimary transform is applied when the transform kernel indicated by thetransform index belongs to a first transform group. For example, thefirst threshold value may be 32, but the present disclosure is notlimited thereto and the first threshold value may be 4, 8, or 16 asshown in Table 20 or Table 21.

In addition, the decoder may determine a smaller value between the widthof the current block and a second threshold value as the width of theregion to which the primary transform is applied and determine a smallervalue between the height of the current block and the second thresholdvalue as the height of the region to which the primary transform isapplied when the transform kernel indicated by the transform indexbelongs to a second transform group. For example, the second thresholdvalue may be 16, but the present disclosure is not limited thereto andthe second threshold value may be 4, 6, 8, 12, or 32 as shown in Table20 or Table 21.

As an embodiment, the first transform group may include DCT-2 and thesecond transform group may include a plurality of transform combinationsof DST7 and/or DCT8.

The decoder performs inverse primary transform on the region to whichthe primary transform is applied using the transform kernel indicated bythe transform index (S2804). The decoder can obtain primarily inverselytransformed transform coefficients by performing the inverse primarytransform. As an embodiment, the decoder may apply secondary transformto inversely quantized transform coefficients prior to the primarytransform. In this case, the methods described above with reference toFIG. 6 to FIG. 26 may be applied.

First Embodiment

According to the embodiments of the present disclosure, it is possibleto considerably reduce worst case complexity by performing a transformonly on a predefined region according to specific conditions.

In addition, in an embodiment of the present disclosure, when the MTS(EMT or AMT) flag is 0 (i.e., when DCT-2 transform is applied in boththe horizontal (lateral) direction and the vertical (longitudinal)direction), the encoder/decoder can perform zero-out for high frequencycomponents (i.e., derive or set the high frequency components as 0)except 32 top-left coefficients in the horizontal and verticaldirections. Although the present embodiment is referred to as a firstembodiment for convenience of description in embodiments which will bedescribed later, embodiments of the present disclosure are not limitedthereto.

For example, in the case of a 64×64 TU (or CU), the encoder/decoder cankeep transform coefficients only for a top-left 32×32 region and performzero-out for coefficients of the remaining region. Further, in the caseof a 64×16 TU, the encoder/decoder can keep transform coefficients onlyfor a top-left 32×16 region and perform zero-out for coefficients of theremaining region. In addition, in the case of an 8×64 TU, theencoder/decoder can keep transform coefficients only for a top-left 8×32region and perform zero-out for coefficients of the remaining region.That is, transform coefficients can be set such that transformcoefficients are present only for a maximum length of 32 in both thehorizontal and vertical directions, which can improve transformefficiency.

As an embodiment, such a zero-out method may be applied to only aresidual signal to which intra-prediction is applied, applied to only aresidual signal to which inter-prediction is applied, or applied to botha residual signal to which intra-prediction is applied and a residualsignal to which inter-prediction is applied.

Second Embodiment

In addition, in an embodiment of the present disclosure, when the MTSflag is 1 (i.e., when a transform (e.g., DST-7 or DCT-8) other thanDCT-2 transform is applied in the horizontal direction and the verticaldirection), the encoder/decoder can perform zero-out for high frequencycomponents (i.e., derive or set the high frequency components as 0)except coefficients of a specific top-left region. Although the presentembodiment is referred to as a second embodiment for convenience ofdescription in embodiments which will be described later, embodiments ofthe present disclosure are not limited thereto.

As an embodiment, the encoder/decoder may keep only a transformcoefficient region corresponding to a part of the top-left region as inthe following examples. That is, the encoder/decoder can preset thelength (or number) of transform coefficients in the horizontal and/orvertical directions to which primary transform is applied depending on awidth and/or a height. For example, coefficients out of the length towhich primary transform is applied can be zero-out.

-   -   When the width (w) is equal to or greater than 2^(n), transform        coefficients only for a length of w/2^(p) from the left side may        be kept and transform coefficients of the remaining region may        be fixed (or set) to 0 (zero-out).    -   When the height (h) is equal to or greater than 2^(m), transform        coefficients only for a length of h/2^(q) from the top may be        kept and transform coefficients of the remaining region may be        fixed to 0.

For example, the values m, n, p, and q may be predefined as variousvalues. For example, the values m, n, p, and q may be set to integervalues equal to or greater than 0. Alternatively, they may be set as inthe following examples.

$\begin{matrix}{\left( {m,n,p,q} \right) = \left( {5,5,1,1} \right)} & \left. 1 \right) \\{\left( {m,n,p,q} \right) = \left( {4,4,1,1} \right)} & \left. 2 \right)\end{matrix}$

When the configuration of 1) is predefined, for example, transformcoefficients may be kept only for a top-left 16×16 region with respectto a 32×16 TU, and transform coefficients may be kept only for atop-left 8×16 region with respect to an 8×32 TU.

As an embodiment, such a zero-out method may be applied to only aresidual signal to which intra-prediction is applied, applied to only aresidual signal to which inter-prediction is applied, or applied to botha residual signal to which intra-prediction is applied and a residualsignal to which inter-prediction is applied.

Third Embodiment

In another embodiment of the present disclosure, when the MTS flag is 1(i.e., when a transform (e.g., DST-7 or DCT-8) other than DCT-2transform is applicable in the horizontal direction and the verticaldirection), the encoder/decoder can perform zero-out for high frequencycomponents (i.e., derive or set the high frequency components as 0)except coefficients of a specific top-left region. More specifically,the encoder can keep the coefficients of the specific top-left regionand perform zero-out for the remaining high frequency components, andthe decoder can recognize the zero-out region in advance and performdecoding using the coefficients of the non-zero-out region. However,embodiments of the present disclosure are not limited thereto, and thezero-out process from the viewpoint of the decoder can be understood asa process of deriving (recognizing or setting) the zero-out region as 0.Although the present embodiment is referred to as a third embodiment forconvenience of description in embodiments which will be described later,embodiments of the present disclosure are not limited thereto.

As an embodiment, the encoder/decoder may keep only a transformcoefficient region corresponding to a part of the top-left region as inthe following examples. That is, the encoder/decoder can preset thelength (or number) of transform coefficients in the horizontal and/orvertical directions to which primary transform is applied depending on awidth and/or a height. For example, coefficients out of the length towhich primary transform is applied can be zero-out.

-   -   When the height (h) is equal to or greater than the width (w)        and equal to or greater than 2^(n), transform coefficients of        only a top-left region w×(h/2^(p)) may be kept and transform        coefficients of the remaining region may be fixed (or set) to 0        (zero-out).    -   When the width (w) is greater than the height (h) and equal to        or greater than 2^(m), transform coefficients of only a top-left        region (w/2^(q))×h may be kept and transform coefficients of the        remaining region may be fixed to 0.

Although the length in the vertical direction is reduced (h/2^(p)) whenthe height (h) equals the width (w) in the above-described example, thelength in the horizontal direction may be reduced (w/2^(q)).

For example, the values m, n, p, and q may be predefined as variousvalues. For example, the values m, n, p, and q may be set to integervalues equal to or greater than 0. Alternatively, they may be set as inthe following examples.

$\begin{matrix}{\left( {m,n,p,q} \right) = \left( {4,4,1,1} \right)} & \left. 1 \right) \\{\left( {m,n,p,q} \right) = \left( {5,5,1,1} \right)} & \left. 2 \right)\end{matrix}$

When the configuration of 1) is predefined, for example, transformcoefficients may be kept only for a top-left 16×16 region with respectto a 32×16 TU, and transform coefficients may be kept only fora top-left8×8 region with respect to an 8×16 TU.

As an embodiment, such a zero-out method may be applied to only aresidual signal to which intra-prediction is applied, applied to only aresidual signal to which inter-prediction is applied, or applied to botha residual signal to which intra-prediction is applied and a residualsignal to which inter-prediction is applied.

The first embodiment pertaining to a method of limiting a transformcoefficient region when the MTS flag is 0, and the second and thirdembodiments pertaining to a method of limiting a transform coefficientregion when the MTS flag is 1 may be individually applied or may beapplied in a combined manner.

As an embodiment, configurations combined as follows may be applied.

$\begin{matrix}{{{First}\mspace{14mu}{embodiment}} + {{second}\mspace{14mu}{embodiment}}} & \left. 1 \right) \\{{{First}\mspace{14mu}{embodiment}} + {{third}\mspace{14mu}{embodiment}}} & \left. 2 \right)\end{matrix}$

As mentioned in the second and third embodiments, the zero-out methodmay be applied to only a residual signal to which intra-prediction isapplied, applied to only a residual signal to which inter-prediction isapplied, or applied to both a residual signal to which intra-predictionis applied and a residual signal to which inter-prediction is applied asan embodiment. Accordingly, configurations combined as follows may beapplied to a case in which the MTS flag is 1. Here, the first embodimentmay be applied to a case in which the MTS flag is 0.

TABLE 22 Intra-prediction Inter-prediction Config. index residual signalresidual signal 1 Zero-out is not applied Zero-out is not applied 2Zero-out is not applied First embodiment 3 Zero-out is not appliedSecond embodiment 4 First embodiment Zero-out is not applied 5 Firstembodiment First embodiment 6 First embodiment Second embodiment 7Second embodiment Zero-out is not applied 8 Second embodiment Firstembodiment 9 Second embodiment Second embodiment

In an embodiment of the present disclosure, the encoder/decoder may notperform residual coding for a region regarded as a region havingtransform coefficients of 0 according to zero-out. That is, theencoder/decoder can be defined such that they perform residual codingonly for regions other than zero-out regions.

In the above-described first, second and third embodiments, a region (orcoefficient) that needs to have a value of 0 is obviously determined.That is, regions other than the top-left region in which presence oftransform coefficients is permitted are zero-out. Accordingly, in anentropy coding (or residual coding) process, the encoder/decoder may beconfigured to bypass a region guaranteed to have a value of 0 withoutperforming residual coding thereon.

In an embodiment, the encoder/decoder may code a flag (referred to assubblock_flag) (or a syntax, or a syntax element) indicating presence orabsence of a non-zero transform coefficient in a coefficient group (CG).Here, the CG is a subblock of a TU and may be set to a 4×4 or 2×2 blockaccording to the shape of the TU block and/or whether the TU is achroma/luma component.

Here, the encoder/decoder can scan the CG to code coefficient values (orcoefficient level values) only in a case where the subblock_flag is 1.Accordingly, the encoder/decoder may configure CGs belonging to azero-out region such that they have a value of 0 by default withoutperforming subblock_flag coding thereon.

Furthermore, in an embodiment, the encoder may first code the positionof a coefficient first located last in forward scanning order (or asyntax or a syntax element indicating the position of the lastsignificant coefficient). For example, the encoder may codelast_coefficient_position_x, that is, a horizontal position, andlast_coefficient_position_y, that is, a vertical position. In thisdocument, the last significant coefficient is a non-zero transformcoefficient positioned at the end when transform coefficients aredisposed according to scanning order from a top left position within onetransform block. A position after the last significant coefficient inthe scanning order is filled with 0 (considered to be 0).

Although maximum values of available values oflast_coefficient_position_x and last_coefficient_position_y may bedetermined as (width −1) and (height −1) of a TU, when a region in whichnon-zero coefficients can be present is limited according to zero-out,the maximum values of available values of last_coefficient_position_xand last_coefficient_position_y may also be limited.

Accordingly, the encoder/decoder may limit the maximum values ofavailable values of last_coefficient_position_x andlast_coefficient_position_y in consideration of zero-out and then codethem. For example, when a binarization method applied tolast_coefficient_position_x and last_coefficient_position_y is atruncated unary (or truncated Rice (TR), or truncated binary (TB))binarization method, the encoder/decoder can control (reduce) a maximumlength of truncated unary code such that it corresponds to adjustedmaximum values (i.e., available maximum values oflast_coefficient_position_x and last_coefficient_position_y).

FIG. 29 is an example of a case where a separable transform is appliedaccording to an embodiment of the present disclosure. FIG. 29Aillustrates a region where a significant coefficient is present and aregion where zero-out is applied upon forward transform. FIG. 29Billustrates a region where a significant coefficient is present and aregion where zero-out is applied upon backward transform.

A scheme for applying zero-out (filled with 0 or derived as 0) to theremainder with coefficients of a low frequency region (e.g., a top left16×16 region in a 32×32 block) left with respect to a block to which MTSis applied on the basis of a forward transform may be denoted as RMTS(reduced multiple transform selection). For example, in FIG. 29A, if thesize of a block including residual sample values is 32×32 and a 16×16reduced block is output by the application of the RMTS, onlycoefficients (16 coefficients from the left) disposed in the left regionin a row direction among coefficients generated by the application of ahorizontal transform are left, and a right region is considered to havecoefficients of 0. Thereafter, only coefficient (16 coefficients fromthe top) disposed in a top region in a column direction amongcoefficients generated by the application of a vertical transform areleft. The remaining lower regions are considered to have coefficients of0.

Referring to FIG. 29B, the size of a transform block including transformcoefficients is 32×32, a transform is applied to a top left 16×16 regionby the application of the RMTS, and the remaining regions are consideredto have coefficients of 0. Since a vertical inverse transform is appliedto the 16×16 region, significant coefficients are generated in the leftregion of the transform block, and the right region is still consideredto have coefficients of 0. Thereafter, since a horizontal inversetransform is applied to the right region, significant coefficients maybe present for the entire 32×32 region of the transform block.

As an embodiment of the present disclosure, there is proposed reduced32-point MTS (RMTS32) in which a transform for high frequencycoefficients is omitted. In this case, the 32-point MTS indicates amethod of applying a transform to a row or a column having a length of32. In this case, the 32-point MTS may require a maximum of 64multiplication operations per output sample by considering the worstcomputational complexity. RMTS32 is proposed to reduce operationalcomplexity and also reduce memory usage.

According to RMTS32, when an MTS flag is 1 (or when an MTS index isgreater than 0) and a block width (height) is greater than or equal to32, a maximum top left 16×16 region is maintained and the remainingregions are considered (zero-out) to be 0, and up to left (top) 16coefficients are maintained. Zero-out is independently appliedhorizontally or vertically, RMTS may be applied to all block shapes.Assuming that RMTS is applied to a 32 length, the top left 16×16 regionmay be maintained for a 32×32 transform block, a top left 16×8 regionmay be maintained for a 32×8 transform block, and a top left 16×16region may be maintained for 16×32.

Operational complexity of 32-point MTS can be reduced to a half by usingRMTS32 from a viewpoint of an operation count. In this case, the32-point MTS is a transform matrix applied to a row or a column having alength 32 of a block (when an MTS flag is 1 or an MTS index is greaterthan 0). Furthermore, from a viewpoint of memory usage, only half thetransform base vectors of 32-point MTS matrices may need to be stored.With respect to a region considered to be 0, residual coding may beomitted because a related subblock flag is implicitly derived as 0.Truncated unary binarization of the last coefficient position may bealso adjusted by considering a maximum possible position.

From a viewpoint of memory usage, RMTS32 generates 16 coefficients for arow or a column having a 32-length. Accordingly, in 32×32 DST-7/DCT-8,only the first 16 transform base vectors need to be stored. Accordingly,memory usage for storing 32-length DST-7/DCT-8 can be reduced to a half(e.g., from 2 KB to 1 KB).

For example, a residual coding syntax for implementing theaforementioned RMTS32 may be set as in Table 23.

TABLE 23 residual_coding(x0, y0, log2TbWidth, log2TbHeight, cIdx) {Descriptor  if(transform_skip_enabled_flag && (cIdx ! = 0 | |tu_mts_flag[x0][y0] = = 0) &&   (log2TbWidth <= 2) && (log2TbHeight <=2))   transform_skip_flag[x0][y0][cIdx] ae(v)  last_sig_coeff_x_prefixae(v)  last_sig_coeff_y_prefix ae(v)  if(last_sig_coeff_x_prefix > 3)  last_sig_coeff_x_suffix ae(v)  if(last_sig_coeff_y_prefix > 3 )  last_sig_coeff_y_suffix ae(v)   . . .  for(i = lastSubBlock, i >= 0;i− −) {    . . .   if((i < lastSubBlock) && (i > 0)) { if(transform_skip_flag[x0][y0][cIdx] == 1 | | (tu_mts_flag[x0][y0] == 0&& (xS << log2SbSize) < 32 && (yS << log2SbSize) < 32) | |(tu_mts_flag[x0][y0] == 1 && (cIdx != 0 | | ((xS << log2SbSize) < 16) &&((yS << log2SbSize) < 16))))    coded_sub_block_flag[xS][yS] ae(v)   inferSbDcSigCoeffFlag = 1   }    . . .  } if(tu_mts_flag[x0][y0] &&(cIdx = = 0))    mts_idx[x0][y0][cIdx] ae(v) }

Furthermore, a valid width (nonZeroW) and a valid height (nonZeroH) of aregion to which a transform is applied in a transform block may bedetermined as follows.

nonZeroW = Min(nTbW, trTypeHor =  = 0?32 : 16)nonZeroH = Min(nTbH, trTypeVer =  = 0?32 : 16)

In this case, nTbW indicates the width of a current block (transformblock), nTbH indicates the height of the current block (transformblock), and trTypeHor and trTypeVer indicate the type of horizontaltransform kernel and the type of vertical transform kernel,respectively. Min(A, B) is a function for outputting a smaller valueamong A and B.

For example, trTypeHor and trTypeVer may be determined as in Table 24based on an MTS index (mts_idx), that is, an index indicating atransform type.

TABLE 24 mts_idx trTypeHor trTypeVer 0 0 0 1 1 1 2 2 1 3 1 2 4 2 2

In this case, a value of trTypeHor, trTypeVer indicates one of types oftransform kernel. For example 0 may indicate DCT-2, 1 may indicateDST-7, and 2 may indicate DCT-8. In Table 24, when mts_idx is 0,trTypeHor and trTypeVer are also determined as 0. When mts_idx is not 0(when it is greater than 0), trTypeHor and trTypeVer are also determinedas a non-zero (greater than 0) value.

In other words, the valid width (nonZeroW) of the region to which atransform is applied is determined as a smaller value among the width(nTbW) of a current block (transform block) and 16 when a transformindex (trTypeHor) is greater than a reference value (e.g., 0) (i.e.,when trTypeHor is not 0), and may be determined a smaller value amongthe width of the current block and 32 when the transform index(trTypeHor) is not greater than a reference value (e.g., 0) (i.e., whentrTypeHor is 0).

Furthermore, the valid height (nonZeroH) of the region to which atransform is applied may be determined as a smaller value among theheight (nTbH) of a current block (transform block) and 16 when avertical transform type index (trTypeVer) is greater than a referencevalue (e.g., 0), and may be determined as a smaller value among theheight (nTbH) of the current block (transform block) and 32 when thevertical transform type index (trTypeVer) is not greater than areference value (e.g., 0).

According to an embodiment of the present disclosure, as follows, onlyhalf the 32-length DST-7/DCT-8 may be stored in the memory.

For example, when a (horizontal or vertical) transform type index(trType) is 1 (e.g., DST-7) and the number of samples of a row or column(nTbs) of a transform target block is 32, a transform matrix may bederived as in Tables 25 and 26. Matrices of Tables 25 and 26 arehorizontally concatenated to constitute one matrix. In [m][n], m is atransversal index, and n is a longitudinal index. If the matrix of Table25 and the matrix of Table 26 are concatenated, a 16×32 matrix isderived, and the corresponding matrix becomes a matrix for a forwardtransform. An inverse transform may be performed through the matrixconfigured by Tables 25 and 26 and proper indexing. Furthermore, inTables 25 and 26, the strike-out for 16 rows below means that the 16rows are deleted because they become unnecessary by the application ofthe reduced transform.

TABLE 25 transMatrix[m][n] = transMatrixCol0to15[m][n] with m = 0..15, n= 0..15 transMatrixCol0to15 =   { { 4 9 13 17 21 26 30 34 38 42 45 50 5356 60 63 } { 13 26 38 50 60 68 77 82 86 89 90 88 85 80 74 66 } { 21 4260 74 84 89 89 84 74 60 42 21 0 −21 −42 −60 } { 30 56 77 88 89 80 63 389 −21 −50 −72 −85 −90 −84 −68 } { 38 68 86 88 74 45 9 −30 −63 −84 −90−78 −53 −17 21 56 } { 45 78 90 77 42 −4 −50 −80 −90 −74 −38 9 53 82 8972 } { 53 85 85 53 0 −53 −85 −85 −53 0 53 85 85 53 0 −53 } { 60 89 74 21−42 −84 −84 −42 21 74 89 60 0 −60 −89 −74 } { 66 90 56 −13 −74 −88 −4526 80 84 34 −38 −85 −78 −21 50 } { 72 86 34 −45 −89 −63 13 78 82 21 −56−90 −53 26 84 77 } { 77 80 9 −72 −84 −17 66 86 26 −60 −88 −34 53 90 42−45 } { 80 72 −17 −86 −60 34 90 45 −50 −89 −30 63 85 13 −74 −78 } { 8460 −42 −89 −21 74 74 −21 −89 −42 60 84 0 −84 −60 42 } { 86 45 −63 −78 2190 26 −77 −66 42 88 4 −85 −50 60 80 } { 88 30 −78 −56 60 77 −34 −88 4 8926 −80 −53 63 74 −38 } { 90 13 −88 −26 84 38 −78 −50 72 60 −63 −68 53 77−42 −82 }

 

},

TABLE 26 transMatrix[m][n] = transMatrixCol16to31[m − 16][n]with m =16..31, n = 0..15 (8-826) transMatrixCol16to31 =   { { 66 68 72 74 77 7880 82 84 85 86 88 88 89 90 90 } { 56 45 34 21 9 −4 −17 −30 −42 −53 −63−72 −78 −84 −88 −90 } { −74 −84 −89 −89 −84 −74 −60 −42 −21 0 21 42 6074 84 89 } { −45 −17 13 42 66 82 90 86 74 53 26 −4 −34 −60 −78 −88 } {80 90 82 60 26 −13 −50 −77 −89 −85 −66 −34 4 42 72 88 } { 34 −13 −56 −84−88 −68 −30 17 60 85 88 66 26 −21 −63 −86 } { −85 −85 −53 0 53 85 85 530 −53 −85 −85 −53 0 53 85 } { −21 42 84 84 42 −21 −74 −89 −60 0 60 89 7421 −42 −84 } { 88 72 9 −60 −90 −63 4 68 89 53 −17 −77 −86 −42 30 82 } {9 −66 −88 −42 38 88 68 −4 −74 −85 −30 50 90 60 −17 −80 } { −90 −50 38 8956 −30 −88 −63 21 85 68 −13 −82 −74 4 78 } { 4 82 68 −21 −88 −56 38 9042 −53 −88 −26 66 84 9 −77 } { 89 21 −74 −74 21 89 42 −60 −84 0 84 60−42 −89 −21 74 } { −17 −90 −30 74 68 −38 −88 −9 84 53 −56 −82 13 89 34−72 } { −86 9 90 21 −82 −50 66 72 −42 −85 13 90 17 −84 −45 68 } { 30 86−17 −89 4 90 9 −88 −21 85 34 −80 −45 74 56 −66 }

},

Furthermore, when a (horizontal or vertical) transform type index(trType) is 2 (e.g., DCT-8) and the number of samples of a row or column(nTbs) of a transform target block is 32, a transform matrix may bederived as in Tables 27 and 28. Matrices of Tables 27 and 28 arehorizontally concatenated to constitute one matrix. In [m][n], m is atransversal index, and n is a longitudinal index. If the matrix of Table27 and the matrix of Table 28 are concatenated, a 16×32 matrix isderived, and the corresponding matrix becomes a matrix for a forwardtransform. An inverse transform may be performed through the matrixconfigured by Tables 27 and 28 and proper indexing. Furthermore, inTables 27 and 28, the strike-out for 16 rows below means that the 16rows are deleted because they become unnecessary by the application ofthe reduced transform.

TABLE 27 transMatrix[m][n] = transMatrixCol0to15[m][n] with m = 0..15, n= 0..15 transMatrixCol0to15 =   { { 90 90 89 88 88 86 85 84 82 80 78 7774 72 68 66 } { 90 88 84 78 72 63 53 42 30 17 4 −9 −21 −34 −45 −56 } {89 84 74 60 42 21 0 −21 −42 −60 −74 −84 −89 −89 −84 −74 } { 88 78 60 344 −26 −53 −74 −86 −90 −82 −66 −42 −13 17 45 } { 88 72 42 4 −34 −66 −85−89 −77 −50 −13 26 60 82 90 80 } { 86 63 21 −26 −66 −88 −85 −60 −17 3068 88 84 56 13 −34 } { 85 53 0 −53 −85 −85 −53 0 53 85 85 53 0 −53 −85−85 } { 84 42 −21 −74 −89 −60 0 60 89 74 21 −42 −84 −84 −42 21 } { 82 30−42 −86 −77 −17 53 89 68 4 −63 −90 −60 9 72 88 } { 80 17 −60 −90 −50 3085 74 4 −68 −88 −38 42 88 66 −9 } { 78 4 −74 −82 −13 68 85 21 −63 −88−30 56 89 38 −50 −90 } { 77 −9 −84 −66 26 88 53 −42 −90 −38 56 88 21 −68−82 −4 } { 74 −21 −89 −42 60 84 0 −84 −60 42 89 21 −74 −74 21 89 } { 72−34 −89 −13 82 56 −53 −84 9 88 38 −68 −74 30 90 17 } { 68 −45 −84 17 9013 −85 −42 72 66 −50 −82 21 90 9 −86 } { 66 −56 −74 45 80 −34 −85 21 88−9 −90 −4 89 17 −86 −30 }

},

TABLE 28 transMatrix[m][n] = transMatrixCol16to31[m − 16][n] with m =16..31, n = 0..15 transMatrixCol16to31 =   { { 63 60 56 53 50 45 42 3834 30 26 21 17 13 9 4 } { −66 −74 −80 −85 −88 −90 −89 −86 −82 −77 −68−60 −50 −38 −26 −13 } { −60 −42 −21 0 21 42 60 74 84 89 89 84 74 60 4221 } { 68 84 90 85 72 50 21 −9 −38 −63 −80 −89 −88 −77 −56 −30 } { 56 21−17 −53 −78 −90 −84 −63 −30 9 45 74 88 86 68 38 } { −72 −89 −82 −53 −938 74 90 80 50 4 −42 −77 −90 −78 −45 } { −53 0 53 85 85 53 0 −53 −85 −85−53 0 53 85 85 53 } { 74 89 60 0 −60 −89 −74 −21 42 84 84 42 −21 −74 −89−60 } { 50 −21 −78 −85 −38 34 84 80 26 −45 −88 −74 −13 56 90 66 } { −77−84 −26 53 90 56 −21 −82 −78 −13 63 89 45 −34 −86 −72 } { −45 42 90 53−34 −88 −60 26 86 66 −17 −84 −72 9 80 77 } { 78 74 −13 −85 −63 30 89 50−45 −90 −34 60 86 17 −72 −80 } { 42 −60 −84 0 84 60 −42 −89 −21 74 74−21 −89 −42 60 84 } { −80 −60 50 85 −4 −88 −42 66 77 −26 −90 −21 78 63−45 −86 } { −38 74 63 −53 −80 26 89 4 −88 −34 77 60 −56 −78 30 88 } { 8242 −77 −53 68 63 −60 −72 50 78 −38 −84 26 88 −13 −90 }

},

By constructing a transform matrix for generating an output vectorincluding 16 sample values with respect to an input vector including 32residual signal samples (upon forward transform) as in Tables 25 and 26or Tables 27 and 28 and performing an inverse transform that outputs anoutput vector including 32 residual signal samples with respect to aninput vector including 16 values by using the matrices of Tables 25 and26 or Tables 27 and 28 and indexing for an inverse transform (uponbackward transform), operational complexity and memory usage can bereduced.

In an embodiment, information on the position of a non-zero lastsignificant coefficient (last_sig_coeff_x_prefix,last_sig_coeff_y_prefix) may be binarized as in Table 29.

TABLE 29 Binarization Syntax structure Syntax element Process Inputparameters . . . . . . . . . . . . residual_coding( ) . . . . . . . . .last_sig_coeff_x_prefix TR cMax = (Min(log2TbWidth, (tu_mts_flag[x0][y0]== 1 && cIdx == 0) ? 4 : 5) << 1) − 1, cRiceParam = 0last_sig_coeff_y_prefix TR cMax = (Min(log2TbHeight,(tu_mts_flag[x0][y0] == 1 && cIdx == 0) ? 4 : 5) << 1) − 1, cRiceParam =0 . . . . . . . . .

A process of Table 29 is an item indicating the type of a binarizationmethod, and TR indicates a truncated rice (or truncated unary)binarization method. Furthermore, cMax and cRiceParam are parameters fordetermining the length of a bin string for unary binarization. Thelength of the bin string may be determined as cMax>>cRiceParam.

In Table 29, information on the position of a non-zero last significantcoefficient (last_sig_coeff_x_prefix, last_sig_coeff_y_prefix) may bedetermined by considering whether a flag (tu_mts_flag) indicatingwhether MTS is applied is 1 (or whether an MTS index is greater than 1)and the width of a transform block, and information related to width(log 2TbWidth, log 2TbHeight). As described above, the last significantcoefficient is a non-zero coefficient finally disposed in scanning orderwithin a transform block.

In other words, an input parameter (cMax) for binarizing a prefix(last_sig_coeff_x_prefix) for a column position (x position) of the lastsignificant coefficient may be said to be determined based on the width(log 2TbWidth) of the transform block. An input parameter for binarizinga prefix (last_sig_coeff_y_prefix) for a row position (y position) ofthe last significant coefficient may be said to be determined based onthe height (log 2TbHeight) of the transform block. As an equal meaning,an input parameter (cMax) for binarizing a prefix(last_sig_coeff_x_prefix) for a column position (x position) of the lastsignificant coefficient may be said to be determined based on the validwidth (log 2ZoTbWidth) of the transform block. An input parameter forbinarizing a prefix (last_sig_coeff_y_prefix) for a row position (yposition) of the last significant coefficient may be said to bedetermined based on the valid height (log 2ZoTbHeight) of the transformblock. In this case, the valid width (log 2ZoTbWidth) is determined as16(4) when the width (log 2TbWidth) of the transform block is 32(5), andis determined as a smaller value among the width (log 2TbWidth) of thetransform block and 32(5) when the width (log 2TbWidth) of the transformblock is not 32(5). Furthermore, the valid height (log 2ZoTbHeight) isdetermined as 16(4) when the height (log 2TbHeight) of the transformblock is 32(5), and is determined as a smaller value among the height(log 2TbHeight) of the transform block and 32(5) when the height (log2TbHeight) of the transform block is not 32(5). In this document, thevalid width means the width (a length from the left) of a region inwhich a non-zero transform coefficient may be present within thetransform block. The valid height means the height (a length from thetop) of a region in which a non-zero transform coefficient may bepresent within the transform block.

Furthermore, another embodiment of the present disclosure provides amethod for residual coding for RMTS32. In the present embodiment,coefficients may be scanned only in a region in which non-zerocoefficients may be present. In other words, a zero-out region is notscanned and may be considered to be filled with values of 0. In thezero-out case of RMTS32, a scanned region may be a top left 16×16region, and the same scanning order as 16×16 TU may be applied to thetop left 16×16 region. Furthermore, truncated unary binarization at thelast coefficient position may be adjusted by considering a maximumpossible position.

A residual coding syntax according to the present embodiment may be thesame as Table 30.

TABLE 30 residual_coding(x0, y0, log2TbWidth, log2TbHeight, cIdx) {Descriptor  if(transform_skip_enabled_flag && (cIdx ! = 0 | |tu_mts_flag[x0][y0] = = 0) &&   (log2TbWidth <= 2) && (log2TbHeight <=2))   transform_skip_flag[x0][y0][cIdx] ae(v)  last_sig_coeff_x_prefixae(v)  last_sig_coeff_y_prefix ae(v)  if(last_sig_coeff_x_prefix > 3)  last_sig_coeff_x_suffix ae(v)  if(last_sig_coeff_y_prefix > 3)  last_sig_coeff_y_suffix ae(v)  log2SbSize = (Min(log2TbWidth,log2TbHeight) < 2 ? 1 : 2)  numSbCoeff = 1 << (log2SbSize << 1) lastScanPos = numSbCoeff log2TbWidth = Min(log2TbWidth,(tu_mts_flag[x0][y0] = = 1 && cIdx == 0) ? 4 : 5)) log2TbHeight =Min(log2TbHeight, (tu_mts_flag[x0][y0] = = 1 && cIdx == 0) ? 4 : 5)) lastSubBlock = (1 << (log2TbWidth + log2TbHeight − 2 * log2SbSize)) − 1 do {   if(lastScanPos = = 0) {    lastScanPos = numSbCoeff   lastSubBlock− −   }   lastScanPos− −   xS = DiagScanOrder[log2TbWidth− log2SbSize][log2TbHeight − log2SbSize]  [lastSubBlock][0]   yS =DiagScanOrder[log2TbWidth − log2SbSize][log2TbHeight − log2SbSize] [lastSubBlock][1]   xC = (xS << log2SbSize) + DiagScanOrder[log2SbSize][log2SbSize][lastScanPos][0]   yC = (yS <<log2SbSize) +  DiagScanOrder[log2SbSize][log2SbSize][lastScanPos][1]  }while((xC != LastSignificantCoeffX) | | (yC != LastSignificantCoeffY)) numSigCoeff = 0  QState = 0  for(i = lastSubBlock, i >= 0; i− −) {  startQStateSb = QState   xS = DiagScanOrder[log2TbWidth −log2SbSize][log2TbHeight − log2SbSize]  [lastSubBlock][0]   yS =DiagScanOrder[log2TbWidth − log2SbSize][log2TbHeight − log2SbSize] [lastSubBlock][1]   inferSbDcSigCoeffFlag = 0   if((i < lastSubBlock)&& (i > 0)) {    coded_sub_block_flag[xS][yS] ae(v)   inferSbDcSigCoeffFlag = 1   }   firstSigScanPosSb = numSbCoeff  lastSigScanPosSb = −1   remBinsPass1 = (log2SbSize < 2 ? 6 : 28)  remBinsPass2 = (log2SbSize < 2 ? 2 : 4)   firstPosMode0 = (i = =lastSubBlock ? lastScanPos − 1 : numSbCoeff − 1)   firstPosMode1 = −1  firstPosMode2 = −1   for(n = (i = = firstPosMode0, n >= 0 &&remBinsPass1 >= 3; n− −) {    xC = (xS << log2SbSize) +DiagScanOrder[log2SbSize][log2SbSize][n][0]    yC = (yS << log2SbSize) +DiagScanOrder[log2SbSize][log2SbSize][n][1]   if(coded_sub_block_flag[xS][yS] && (n > 0 | |!inferSbDcSigCoeffFlag)) {     sig_coeff_flag[xC][yC] ae(v)    remBinsPass1− −     if(sig_coeff_flag[xC][yC])     inferSbDcSigCoeff Flag = 0    }    if(sig_coeff_flag[xC][yC]) {    numSigCoeff++     abs_level_gt1_flag[n] ae(v)     remBinsPass1− −    if(abs_level_gt1_flag[n]) {      par_level_flag[n] ae(v)     remBinsPass1− −      if(remBinsPass2 > 0) {       remBinsPass2− −      if(remBinsPass2 = = 0)        firstPosMode1 = n − 1      }     }    if(lastSigScanPosSb = = −1)      lastSigScanPosSb = n    firstSigScanPosSb = n    }    AbsLevelPass1[xC][yC] =     sig_coeff_flag[xC][yC] + par_level_flag[n] + abs_level_gt1_flag[n]   if(dep_quant_enabled_flag)      QState =QStateTransTable[QState][AbsLevelPass1[xC][yC] & 1]    if(remBinsPass1 <3)     firstPosMode2 = n − 1   }   if(firstPosMode1 < firstPosMode2)   firstPosMode1 = firstPosMode2   for(n = numSbCoeff − 1; n >=firstPosMode2; n− −)    if(abs_level_gt1 _flag[n])    abs_level_gt3_flag[n] ae(v)   for(n = numSbCoeff − 1; n >=firstPosMode1 , n− −) {    xC = (xS << log2SbSize) +DiagScanOrder[log2SbSize][log2SbSize][n][0]    yC = (yS << log2SbSize) +DiagScanOrder[log2SbSize][log2SbSize][n][1]    if(abs_level_gt3_flag[n])    abs_remainder[n] ae(v)    AbsLevel[xC][yC] = AbsLevelPass1[xC][yC] + 2 * (abs_level_gt3_flag[n] + abs_remainder[n])   }   for(n =firstPosMode1; n > firstPosMode2; n− −) {    xC = (xS << log2SbSize) +DiagScanOrder[log2SbSize][log2SbSize][n][0]    yC = (yS << log2SbSize) +DiagScanOrder[log2SbSize][log2SbSize][n][1]    if(abs_level_gt1_flag[n])    abs_remainder[n] ae(v)    AbsLevel[xC][yC] = AbsLevelPass1[xC][yC] +2 * abs_remainder[n]   }   for(n = firstPosMode2; n >= 0; n− −) {    xC= (xS << log2SbSize) + DiagScanOrder[log2SbSize][log2SbSize][n][0]    yC= (yS << log2SbSize) + DiagScanOrder[log2SbSize][log2SbSize][n][1]   dec_abs_level[n] ae(v)    if(AbsLevel[xC][yC] > 0)    firstSigScanPosSb = n    if(dep_quant_enabled_flag)     QState =QStateTransTable[QState][AbsLevel[xC][yC] & 1]   }  if(dep_quant_enabled_flag | | !sign_data_hiding_enabled_flag)   signHidden = 0   else    signHidden = (lastSigScanPosSb −firstSigScanPosSb > 3 ? 1 : 0)   for(n = numSbCoeff − 1; n >= 0; n− −) {   xC = (xS << log2SbSize) + DiagScanOrder[log2SbSize][log2SbSize][n][0]   yC = (yS << log2SbSize) + DiagScanOrder[log2SbSize][log2SbSize][n][1]   if(sig_coeff_flag[xC][yC] &&     (!signHidden | | (n !=firstSigScanPosSb)))     coeff_sign_flag[n] ae(v)   }  if(dep_quant_enabled_flag) {    QState = startQStateSb    for(n =numSbCoeff − 1; n >= 0; n− −) {     xC = (xS << log2SbSize) + DiagScanOrder[log2SbSize][log2SbSize][n][0]     yC = (yS <<log2SbSize) +  DiagScanOrder[log2SbSize][log2SbSize][n][1]    if(sig_coeff_flag[xC][yC])  TransCoeffLevel[x0][y0][cIdx][xC][yC] =       (2 * AbsLevel[xC][yC] − (QState > 1 ? 1 : 0)) *        (1 − 2 *coeff_sign_flag[n])     QState =QStateTransTable[QState][par_level_flag[n]]   } else {    sumAbsLevel =0    for(n = numSbCoeff − 1; n >= 0; n− −) {     xC = (xS <<log2SbSize) +  DiagScanOrder[log2SbSize][log2SbSize][n][0]     yC = (yS<< log2SbSize) +  DiagScanOrder[log2SbSize][log2SbSize][n][1]    if(sig_coeff_flag[xC][yC]) {  TransCoeffLevel[x0][y0][cIdx][xC][yC]=        AbsLevel[xC][yC] * (1 − 2 * coeff_sign_flag[n])     if(signHidden) {       sumAbsLevel += AbsLevel[xC][yC]       if((n= = firstSigScanPosSb) && (sumAbsLevel % 2) = = 1)) TransCoeffLevel[x0][y0][cIdx][xC][yC] = −TransCoeffLevel[x0][y0][cIdx][xC][yC]      }     }    }   }  } if(tu_mts_flag[x0][y0] && (cIdx = = 0))   mts_idx[x0][y0][cIdx] ae(v) }

In Table 30, last_sig_coeff_x_prefix and last_sig_coeff_y_prefix, thatis, syntax elements related to the position of the last significantcoefficient may be defined as follows.

last_sig_coeff_x_prefix indicates a prefix for a column position of thelast significant coefficient according to scanning order within thetransform block. An array index x0, y0 indicates a position (x0, y0) ofa top left sample of the transform block for a top left sample of apicture. An array index cldx indicates an indicator for a chromacomponent, and may be set like 0 for a luma, 1 for Cb, and 2 for Cr.Values of last_sig_coeff_x_prefix may be values within a range from 0 to(Min(log 2TbWidth, (tu_mts_flag[x0][y0]==1 && cldx==0) ? 4:5))<<1)−1.

In other words, a maximum value of last_sig_coeff_x_prefix may be(Min(log 2TbWidth, (tu_mts_flag[x0][y0]==1 && cldx==0) ? 4:5))<<1)−1. Inthis case, log 2TbWidth is a value that takes log having a base of 2 inthe width of the transform block. tu_mts_flag indicates whether MTS isapplied to the transform block. When tu_mts_flag is 1, DST-7 or DCT-8may be applied to the transform block horizontally and vertically. Whentu_mts_flag is 1 and when the MTS index (mts_idx) is greater than 0,they have the same meaning. Accordingly, tu_mts_flag[x0][y0]==1 may berepresented like mts_idx[x0][y0]>0. Furthermore, Min(A, B) is a functionfor outputting a smaller value among A and B.

That is, when MTS is not applied (when tu_mts_flag is 0), a maximumvalue of last_sig_coeff_x_prefix is determined based on a smaller valueamong log 2TbWidth and 5. When MTS is applied (when tu_mts_flag is not0), a maximum value of last_sig_coeff_x_prefix is determined based on asmaller value among log 2TbWidth and 4. In other words, when MTS isapplied to a luma block and the width of a transform block is 32 (if log2TbWidth is 5 and a transform is applied to some region), a maximumvalue of last_sig_coeff_x_prefix is determined as (4<<1)−1=7.

In other words, a prefix (last_sig_coeff_x_prefix) for a row position ofthe last significant coefficient according to scanning order within atransform block may be said to be determined based the valid width (log2ZoTbWidth) of the transform block. In this case, when MTS is applied(when mts_flag is not 0 or when mts_idx is greater than 1), the validwidth (log 2ZoTbWidth) is determined as 16 (log 2ZoTbWidth is 4) whenthe width of the transform block is 32 (when log 2TbWidth is 5 and atransform is applied to some region), and the valid width (log2ZoTbWidth) is determined as a smaller value (a smaller value among log2TbWidth and 5) among the width of the transform block and 32 when thewidth of the transform block is not 32.

last_sig_coeff_y_prefix indicates a prefix for a row position of thelast significant coefficient according to scanning order within atransform block. An array index x0, y0 indicates a position (x0, y0) ofa top left sample of the transform block for a top left sample of apicture. An array index cldx indicates an indicator for a chromacomponent, and may be set as 0 for a luma, 1 for Cb, and 2 for Cr.Values of last_sig_coeff_y_prefix may be values within a range from 0 to(Min(log 2TbHeight, (tu_mts_flag[x0][y0]==1 && cldx==0) ? 4:5))<<1)−1.

As in last_sig_coeff_x_prefix, a maximum value oflast_sig_coeff_y_prefix may be (Min(log 2TbHeight,(tu_mts_flag[x0][y0]==1 && cldx==0) ? 4:5))<<1)−1. In this case, log2TbHeight indicates a value that takes log having a base of 2 in theheight of a transform block.

That is, when MTS is not applied (when tu_mts_flag is 0), a maximumvalue of last_sig_coeff_y_prefix is determined based on a smaller valueamong log 2TbHeight and 5. When MTS is applied (when tu_mts_flag is not0), a maximum value of last_sig_coeff_y_prefix is determined based on asmaller value among log 2TbHeight and 4. In other words, when MTS isapplied and the height of the transform block is 32 (when log 2TbHeightis 5), a maximum value of last_sig_coeff_y_prefix is determined as(4<<1)−1=7.

In other words, the prefix (last_sig_coeff_y_prefix) for a columnposition of the last significant coefficient according to scanning orderwithin the transform block may be said to be determined based on thevalid height of the transform block. In this case, when MTS is applied(when mts_flag is not 0 or when mts_idx is greater than 1), the validheight is determined as 16 (log 2ZoTbHeight is 4) when the height of thetransform block is 32 (when log 2TbHeight is 5), and the valid width(log 2ZoTbWidth) is determined as a smaller value (a smaller value amonglog 2TbHeight and 5) among the height of the transform block and 32 whenthe height of the transform block is not 32.

A position of the last significant coefficient within the transformblock may be derived using last_sig_coeff_x_prefix,last_sig_coeff_y_prefix derived as described above. Scanning or atransform may be performed on the transform block based on the positionof the last significant coefficient.

Furthermore, a suffix for determining the position of the lastsignificant coefficient may be additionally used. Referring to Table 30,when last_sig_coeff_x_prefix is greater than a reference value 3, asuffix (last_sig_coeff_x_suffix) related to a column position of thelast significant coefficient may be obtained. Furthermore, whenlast_sig_coeff_y_prefix is greater than the reference value 3, a suffix(last_sig_coeff_y_suffix) related to a row position of the lastsignificant coefficient may be obtained. If last_sig_coeff_x_suffix ispresent, a column position (LastSignificantCoeffX) of the lastsignificant coefficient may be determined based onlast_sig_coeff_x_prefix and last_sig_coeff_x_suffix. Furthermore, iflast_sig_coeff_y_suffix is present, a column position(LastSignificantCoeffY) of the last significant coefficient may bedetermined based on last_sig_coeff_y_prefix and last_sig_coeff_y_suffix.

Some of the aforementioned embodiments of the present disclosure may bedivided and described for convenience sake, but the present disclosureis not limited thereto. That is, the aforementioned embodiments may beindependently performed, and one or more several embodiments may becombined and performed.

FIG. 30 illustrates an example of a flowchart for encoding a videosignal according to an embodiment of the present disclosure.

Operations of FIG. 30 are described as being performed by the encoder,but a transform method for a video signal according to the presentembodiment may also be substantially identically applied to the decoder.The flowchart of FIG. 30 may be performed by the encoding apparatus 100or the transform unit 120.

In step S3010, the encoding apparatus 100 generate a transform blockincluding a transform coefficient by performing a transform on atransform target area of a processing target block including a residualsignal except a prediction signal in a video signal.

In step S3020, the encoding apparatus 100 encodes residual codinginformation related to the residual signal. In this case, the residualcoding information includes position information of the last significantcoefficient according to scanning order within a transform block. Theposition information of the last significant coefficient includes afirst prefix (last_sig_coeff_x_prefix) for a column position of the lastsignificant coefficient and a second prefix (last_sig_coeff_y_prefix)for a row position of the last significant coefficient.

In particular, the range of the first prefix (last_sig_coeff_x_prefix)is determined based on the valid width (log 2ZoTbWidth) of the transformblock, and the range of the second prefix (last_sig_coeff_y_prefix) isdetermined based on the valid height (log 2ZoTbHeight) of the transformblock. If the width (log 2TbWidth) of the transform block corresponds toa first size (e.g., 5) (if RMTS32 is applied), the valid width (log2ZoTbWidth) of the transform block is determined as a second size 4. Ifthe height (log 2TbHeight) of the transform block corresponds to thefirst size 5 (if RMTS32 is applied), the valid height (log 2ZoTbHeight)of the transform block is determined as the second size 4. In this case,the second size may be any value smaller than the first size.

For example, the range of the first prefix (last_sig_coeff_x_prefix) maybe set from 0 to (Min(log 2TbWidth, (tu_mts_flag[x0][y0]==1 && cldx==0)? 4:5))<<1)−1. Furthermore, the range of the second prefix(last_sig_coeff_y_prefix) may be set from 0 to (Min(log 2TbHeight,(tu_mts_flag[x0][y0]==1 && cldx==0) ? 4:5))<<1)−1. That is, as describedabove, since a transform is applied to some reduced regions when MTS isapplied to a luma block having the width (log 2TbWidth) of 32, the validwidth (log 2ZoTbWidth) is determined as 16(4). Likewise, since atransform is applied to some reduced regions when MTS is applied to aluma block having the height (log 2TbHeight) of 32, the valid width (log2ZoTbHeight) is determined as 16(4).

In an embodiment, if the width (log 2TbWidth) of the transform block isdifferent from the first size 5, the valid width (log 2ZoTbWidth) of thetransform block may be determined as a smaller value among the width(log 2TbWidth) of the transform block and the first size 5 (log2ZoTbWidth=Min(log 2TbWidth, 5)). If the height (log 2TbHeight) of thetransform block is different from the first size 5, the valid height(log 2ZoTbHeight) of the transform block may be determined as a smallervalue among the height (log 2TbHeight) of the transform block and thefirst size 5 (log 2ZoTbHeight=Min(log 2TbHeight, 5)).

In an embodiment, the first size may be set as 32, and the second sizemay be set as 16. As in Table 30, if variables (log 2ZoTbWidth, log2TbHeight) to which log has been applied are used, the first size may beset as 5, and the second size may be set as 4.

In an embodiment, an input parameter (cMax) for binarizing a firstprefix (last_sig_coeff_x_prefix) may be determined based on the width(log 2TbWidth) of a transform block, and an input parameter forbinarizing a second prefix (last_sig_coeff_y_prefix) may be determinedbased on the height (log 2TbWidth) of the transform block. As in Table29, an input parameter for binarizing the first prefix(last_sig_coeff_x_prefix) and the second prefix(last_sig_coeff_y_prefix) may be set as cMax=(Min(log 2TbWidth,(tu_mts_flag[x0][y0]==1 && cldx==0) ? 4:5)<<1)−1, cMax=(Min(log2TbHeight, (tu_mts_flag[x0][y0]==1 && cldx==0) ? 4:5)<<1)−1.

In an embodiment, a column position of the last significant coefficientis determined based on the first prefix (last_sig_coeff_x_prefix) and afirst suffix (last_sig_coeff_x_suffix). A row position of the lastsignificant coefficient is determined based on the second prefix(last_sig_coeff_y_prefix) and a second suffix (last_sig_coeff_y_suffix).In this case, a first suffix (last_sig_coeff_x_suffix) may be includedin residual coding information and coded, when the first prefix(last_sig_coeff_x_prefix) is greater than a reference value 3. A secondsuffix (last_sig_coeff_y_suffix) may be included in residual codinginformation and coded, when the second prefix (last_sig_coeff_y_prefix)is greater than the reference value 3.

In an embodiment, when the width or height of a processing target blockcorresponds to the first size, the encoding apparatus 100 may set thewidth or height of a transform target area as the second size, and mayconsider a portion other than the transform target area within theprocessing target block to be 0.

FIG. 31 illustrates an example of a flowchart for decoding a videosignal according to an embodiment of the present disclosure.

Operations of FIG. 30 are described as being performed by the decoder,but the present disclosure is not limited thereto. A transform methodfor a video signal according to the present embodiment may besubstantially identically applied to the encoder. The flowchart of FIG.31 may be performed by the decoding apparatus 200 or the inversetransform unit 230.

In step S3110, the decoding apparatus 200 obtains position informationof the last significant coefficient according to scanning order within atransform block.

In this case, the position information of the last significantcoefficient includes a first prefix (last_sig_coeff_x_prefix) for acolumn position of the last significant coefficient and a second prefix(last_sig_coeff_y_prefix) for a row position of the last significantcoefficient.

In particular, the range of the first prefix (last_sig_coeff_x_prefix)is determined based on the valid width (log 2ZoTbWidth) of the transformblock, and the range of the second prefix (last_sig_coeff_y_prefix) isdetermined based on the valid height (log 2ZoTbHeight) of the transformblock. If RMTS32 is applied and the width (log 2TbWidth) of thetransform block corresponds to a first size (e.g., 5), the valid width(log 2ZoTbWidth) of the transform block is determined as a second size4. If RMTS32 is applied and the height (log 2TbHeight) of the transformblock corresponds to the first size (e.g., 5), the valid height (log2ZoTbWidth) of the transform block is determined as the second size(e.g., 4). In this case, the second size may be any value smaller thanthe first size.

For example, the range of the first prefix (last_sig_coeff_x_prefix) maybe set from 0 to (Min(log 2TbWidth, (tu_mts_flag[x0][y0]==1 && cldx==0)? 4:5))<<1)−1. Furthermore, the range of the second prefix(last_sig_coeff_y_prefix) may be set from 0 to (Min(log 2TbWidth,(Min(log 2TbHeight, (tu_mts_flag[x0][y0]==1 && cldx==0) ? 4:5))<<1)−1.

In an embodiment, if the width (log 2TbWidth) of the transform block isdifferent from the first size 5, the valid width (log 2ZoTbWidth) of thetransform block may be determined as a smaller value among the width(log 2TbWidth) of the transform block and the first size 5 (log2ZoTbWidth=Min(log 2TbWidth, 5)). If the height (log 2TbHeight) of thetransform block is different from the first size 5, the valid height(log 2ZoTbHeight) of the transform block may be determined as a smallervalue among the height (log 2TbHeight) of the transform block and thefirst size 5 (log 2ZoTbHeight=Min(log 2TbHeight, 5)).

In an embodiment, as in Table 30, if variables (log 2ZoTbWidth, log2TbHeight) to which log has been applied are used, the first size may beset as 5, and the second size may be set as 4. If log is not applied,the first size may be set as 32, and the second size may be set as 16.

In an embodiment, an input parameter (cMax) for binarizing the firstprefix (last_sig_coeff_x_prefix) may be determined based on the width(log 2TbWidth) of the transform block. An input parameter for binarizingthe second prefix (last_sig_coeff_y_prefix) may be determined based onthe height (log 2TbWidth) of the transform block. As in Table 29, aninput parameter for binarizing the first prefix(last_sig_coeff_x_prefix) and the second prefix(last_sig_coeff_y_prefix) may be set as cMax=(Min(log 2TbWidth,(tu_mts_flag[x0][y0]==1 && cldx==0) ? 4:5)<<1)−1, cMax=(Min(log2TbHeight, (tu_mts_flag[x0][y0]==1 && cldx==0) ? 4:5)<<1)−1.

In an embodiment, a column position of the last significant coefficientis determined based on the first prefix (last_sig_coeff_x_prefix) andthe first suffix (last_sig_coeff_x_suffix). A row position of the lastsignificant coefficient is determined based on the second prefix(last_sig_coeff_y_prefix) and the second suffix(last_sig_coeff_y_suffix). In this case, the first suffix(last_sig_coeff_x_suffix) may be obtained when the first prefix(last_sig_coeff_x_prefix) is greater than a reference value 3. Thesecond suffix (last_sig_coeff_y_suffix) may be obtained when the secondprefix (last_sig_coeff_y_prefix) is greater than the reference value 3.

In an embodiment, when the width or height of the transform blockcorresponds to the first size, the decoding apparatus 200 may set thewidth or height of the transform target area as the second size, and mayconsider a portion other than a transform target area within thetransform block as 0.

In step S3120, the decoding apparatus 200 performs residual coding basedon the position information of the last significant coefficient.

FIG. 32 is an embodiment to which the present disclosure is applied andillustrates an example of a block diagram of an apparatus for processinga video signal. The apparatus for processing a video signal of FIG. 32may correspond to the encoding apparatus 100 of FIG. 1 or the decodingapparatus 200 of FIG. 2.

An image processing apparatus 3200 for processing an image signalincludes a memory 3220 for storing an image signal and a processor 3210coupled to the memory, for processing an image signal.

The processor 3210 according to an embodiment of the present disclosuremay consist of at least one processing circuit for processing an imagesignal, and may process an image signal by executing instructions forencoding or decoding the image signal. That is, the processor 3210 mayencode the original image data or decode an encoded image signal byexecuting the aforementioned encoding or decoding methods.

Furthermore, the processing methods to which the present disclosure isapplied may be manufactured in the form of a program executed by acomputer and stored in computer-readable recording media. Multimediadata having the data structure according to the present disclosure mayalso be stored in computer-readable recording media. Thecomputer-readable recording media include all types of storage devicesand distributed storage devices in which data readable by a computer isstored. The computer-readable recording media may include a Blueray disk(BD), a universal serial bus (USB), a ROM, a PROM, an EEPROM, a RAM, aCD-ROM, a magnetic tape, a floppy disk, and an optical data storagedevice, for example. Furthermore, the computer-readable recording mediaincludes media implemented in the form of carrier waves (e.g.,transmission through the Internet). Furthermore, a bit stream generatedby the encoding method may be stored in a computer-readable recordingmedium or may be transmitted over wired/wireless communication networks.

Moreover, embodiments of the present disclosure may be implemented ascomputer program products according to program code and the program codemay be executed in a computer according to embodiment of the presentdisclosure. The program code may be stored on computer-readablecarriers.

As described above, the embodiments of the present disclosure may beimplemented and executed on a processor, a microprocessor, a controlleror a chip. For example, functional units shown in each figure may beimplemented and executed on a computer, a processor, a microprocessor, acontroller or a chip.

Furthermore, the decoder and the encoder to which the present disclosureis applied may be included in multimedia broadcasttransmission/reception apparatuses, mobile communication terminals, homecinema video systems, digital cinema video systems, monitoring cameras,video conversation apparatuses, real-time communication apparatuses suchas video communication, mobile streaming devices, storage media,camcorders, video-on-demand (VoD) service providing apparatuses, overthe top video (OTT) video systems, Internet streaming service providingapparatuses, 3D video systems, video phone video systems, medical videosystems, etc. and may be used to process video signals or data signals.For example, OTT video systems may include game consoles, Bluerayplayers, Internet access TVs, home theater systems, smartphones, tabletPCs, digital video recorders (DVRs), etc.

Furthermore, the processing methods to which the present disclosure isapplied may be manufactured in the form of a program executed by acomputer and stored in computer-readable recording media. Multimediadata having the data structure according to the present disclosure mayalso be stored in computer-readable recording media. Thecomputer-readable recording media include all types of storage devicesand distributed storage devices in which data readable by a computer isstored. The computer-readable recording media may include a Blueray disk(BD), a universal serial bus (USB), a ROM, a PROM, an EEPROM, a RAM, aCD-ROM, a magnetic tape, a floppy disk, and an optical data storagedevice, for example. Furthermore, the computer-readable recording mediaincludes media implemented in the form of carrier waves (e.g.,transmission through the Internet). Furthermore, a bit stream generatedby the encoding method may be stored in a computer-readable recordingmedium or may be transmitted over wired/wireless communication networks.

Moreover, embodiments of the present disclosure may be implemented ascomputer program products according to program code and the program codemay be executed in a computer according to embodiment of the presentdisclosure. The program code may be stored on computer-readablecarriers.

Embodiments described above are combinations of elements and features ofthe present disclosure. The elements or features may be consideredselective unless otherwise mentioned. Each element or feature may bepracticed without being combined with other elements or features.Further, an embodiment of the present disclosure may be constructed bycombining parts of the elements and/or features. Operation ordersdescribed in embodiments of the present disclosure may be rearranged.Some constructions of any one embodiment may be included in anotherembodiment and may be replaced with corresponding constructions ofanother embodiment. It is obvious to those skilled in the art thatclaims that are not explicitly cited in each other in the appendedclaims may be presented in combination as an exemplary embodiment orincluded as a new claim by a subsequent amendment after the applicationis filed.

The implementations of the present disclosure may be achieved by variousmeans, for example, hardware, firmware, software, or a combinationthereof. In a hardware configuration, the methods according to theimplementations of the present disclosure may be achieved by one or moreapplication specific integrated circuits (ASICs), digital signalprocessors (DSPs), digital signal processing devices (DSPDs),programmable logic devices (PLDs), field programmable gate arrays(FPGAs), processors, controllers, microcontrollers, microprocessors,etc.

In a firmware or software configuration, the implementations of thepresent disclosure may be implemented in the form of a module, aprocedure, a function, etc. Software code may be stored in the memoryand executed by the processor. The memory may be located at the interioror exterior of the processor and may transmit data to and receive datafrom the processor via various known means.

Those skilled in the art will appreciate that the present disclosure maybe carried out in other specific ways than those set forth hereinwithout departing from the spirit and essential characteristics of thepresent disclosure. Accordingly, the above embodiments are therefore tobe construed in all aspects as illustrative and not restrictive. Thescope of the present disclosure should be determined by the appendedclaims and their legal equivalents, not by the above description, andall changes coming within the meaning and equivalency range of theappended claims are intended to be embraced therein,

INDUSTRIAL APPLICABILITY

Although exemplary aspects of the present disclosure have been describedfor illustrative purposes, those skilled in the art will appreciate thatvarious modifications, additions and substitutions are possible, withoutdeparting from essential characteristics of the disclosure.

1. A method for decoding a video signal, comprising: determining asignificant width and a significant height of a transform block based ona multiple transform selection (MTS) flag, wherein the MTS flagrepresents information related to whether a MTS is applied; obtainingposition information of a last significant coefficient in a scanningorder within the transform block; and performing residual coding basedon the position information of the last significant coefficient, whereinthe position information of the last significant coefficient includes afirst prefix for a column position of the last significant coefficientand a second prefix for a row position of the last significantcoefficient, wherein a range of the first prefix is determined based onthe significant width of the transform block, wherein a range of thesecond prefix is determined based on the significant height of thetransform block, wherein when a width of the transform block correspondsto a first size, the significant width of the transform block isdetermined as a second size, wherein when a height of the transformblock corresponds to the first size, the significant height of thetransform block is determined as the second size, and wherein the secondsize is smaller than the first size.
 2. The method of claim 1, whereinthe first size is 32, and wherein the second size is
 16. 3. The methodof claim 1, wherein when the width of the transform block is differentfrom the first size, the significant width of the transform block isdetermined as a smaller value among the width of the transform block andthe first size, and wherein when the height of the transform block isdifferent from the first size, the significant height of the transformblock is determined as a smaller value among the height of the transformblock and the first size.
 4. The method of claim 1, wherein an inputparameter for a binarization of the first prefix is determined based onthe width of the transform block, and wherein an input parameter for abinarization of the second prefix is determined based on the height ofthe transform block.
 5. The method of claim 1, wherein the columnposition of the last significant coefficient is determined based on thefirst prefix and a first suffix, wherein the row position of the lastsignificant coefficient is determined based on the second prefix and asecond suffix, wherein the first suffix is obtained when the firstprefix is greater than a reference value, and wherein the second suffixis obtained when the second prefix is greater than the reference value.6. The method of claim 1, further comprising: determining a transformtarget area; and performing an inverse transform on the transform targetarea, wherein determining the transform target area includes: setting awidth or height of the transform target area as the second size when thewidth or height of the transform block corresponds to the first size;and deriving a portion other than the transform target area within thetransform block to be
 0. 7. A method for encoding a video signal,comprising: generating a transform block including a transformcoefficient by performing a transform on a transform target area of aprocessing block, wherein the processing block includes a residualsignal except a prediction signal in the video signal; encoding residualcoding information related to the residual signal; and generating amultiple transform selection (MTS) flag, wherein the MTS flag representsinformation related to whether a MTS is applied to the processing block;wherein the residual coding information includes position information ofa last significant coefficient in a scanning order within the transformblock, wherein the position information of the last significantcoefficient includes a first prefix for a column position of the lastsignificant coefficient and a second prefix for a row position of thelast significant coefficient, wherein a range of the first prefix isdetermined based on a significant width of the transform block, whereina range of the second prefix is determined based on a significant heightof the transform block, wherein when a width of the transform blockcorresponds to a first size, the significant width of the transformblock is determined as a second size, wherein when a height of thetransform block corresponds to the first size, the significant height ofthe transform block is determined as the second size, and wherein thesecond size is smaller than the first size.
 8. The method of claim 7,wherein the first size is 32, and wherein the second size is
 16. 9. Themethod of claim 7, wherein when the width of the transform block isdifferent from the first size, the significant width of the transformblock is determined as a smaller value among the width of the transformblock and the first size, and wherein when the height of the transformblock is different from the first size, the significant height of thetransform block is determined as a smaller value among the height of thetransform block and the first size.
 10. The method of claim 7, whereinan input parameter for a binarization of the first prefix is determinedbased on the significant width of the transform block, and wherein aninput parameter for a binarization of the second prefix is determinedbased on the significant height of the transform block.
 11. The methodof claim 7, wherein the position information of the last significantcoefficient includes a first suffix for the column position of the lastsignificant coefficient and a second suffix for the row position of thelast significant coefficient, wherein the first suffix is coded as theposition information of the last significant coefficient when the firstprefix is greater than a reference value, and wherein the second suffixis coded as the position information of the last significant coefficientwhen the second prefix is greater than the reference value.
 12. Themethod of claim 7, wherein generating the transform block includes:setting the width or height of the transform target area as the secondsize when the width or height of the processing block corresponds to thefirst size; and deriving a portion except the transform target areawithin the processing block to be
 0. 13-15. (canceled)
 16. Anon-transitory computer-readable storage medium storing pictureinformation generated by performing the steps of: generating a transformblock including a transform coefficient by performing a transform on atransform target area of a processing block, wherein the processingblock includes a residual signal except a prediction signal in the videosignal; encoding residual coding information related to the residualsignal; and generating a multiple transform selection (MTS) flag,wherein the MTS flag represents information related to whether a MTS isapplied to the processing block; wherein the residual coding informationincludes position information of a last significant coefficient in ascanning order within the transform block, wherein the positioninformation of the last significant coefficient includes a first prefixfor a column position of the last significant coefficient and a secondprefix for a row position of the last significant coefficient, wherein arange of the first prefix is determined based on a significant width ofthe transform block, wherein a range of the second prefix is determinedbased on a significant height of the transform block, wherein when awidth of the transform block corresponds to a first size, thesignificant width of the transform block is determined as a second size,wherein when a height of the transform block corresponds to the firstsize, the significant height of the transform block is determined as thesecond size, and wherein the second size is smaller than the first size.